Skip to content

Commit bffb0de

Browse files
committed
tests: Use arguments in codegen/stores.rs to turn aggregates into immediates.
1 parent 6c0674e commit bffb0de

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/test/codegen/stores.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,18 @@ pub struct Bytes {
2323
// The array is stored as i32, but its alignment is lower, go with 1 byte to avoid target
2424
// dependent alignment
2525
#[no_mangle]
26-
pub fn small_array_alignment(x: &mut [i8; 4]) {
27-
// CHECK: [[VAR:%[0-9]+]] = load {{(\[4 x i8\]\*, )?}}[4 x i8]** %x
28-
// CHECK: [[VAR2:%[0-9]+]] = bitcast [4 x i8]* [[VAR]] to i32*
29-
// CHECK: store i32 %{{.*}}, i32* [[VAR2]], align 1
30-
*x = [0; 4];
26+
pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) {
27+
// CHECK: [[VAR:%[0-9]+]] = bitcast [4 x i8]* %y to i32*
28+
// CHECK: store i32 %{{.*}}, i32* [[VAR]], align 1
29+
*x = y;
3130
}
3231

3332
// CHECK-LABEL: small_struct_alignment
3433
// The struct is stored as i32, but its alignment is lower, go with 1 byte to avoid target
3534
// dependent alignment
3635
#[no_mangle]
37-
pub fn small_struct_alignment(x: &mut Bytes) {
38-
// CHECK: [[VAR:%[0-9]+]] = load {{(%Bytes\*, )?}}%Bytes** %x
39-
// CHECK: [[VAR2:%[0-9]+]] = bitcast %Bytes* [[VAR]] to i32*
40-
// CHECK: store i32 %{{.*}}, i32* [[VAR2]], align 1
41-
*x = Bytes {
42-
a: 0,
43-
b: 0,
44-
c: 0,
45-
d: 0,
46-
};
36+
pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) {
37+
// CHECK: [[VAR:%[0-9]+]] = bitcast %Bytes* %y to i32*
38+
// CHECK: store i32 %{{.*}}, i32* [[VAR]], align 1
39+
*x = y;
4740
}

0 commit comments

Comments
 (0)