about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorAsuna <SpriteOvO@gmail.com>2024-10-20 23:17:04 +0200
committerAsuna <SpriteOvO@gmail.com>2024-10-23 04:42:21 +0200
commit57bffe1d59cb6caa39c6ae5f5620c0cb371eea72 (patch)
treee0d08df1c934b4a7fabeeaf0b6e5e076400c58a3 /tests/codegen
parent6b6552462031422f41d6b39303f892ca9a4a7b5f (diff)
Set `signext` or `zeroext` for integer arguments on LoongArch64
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/rust-abi-arch-specific-adjustment.rs48
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs2
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-checks.rs2
3 files changed, 35 insertions, 17 deletions
diff --git a/tests/codegen/rust-abi-arch-specific-adjustment.rs b/tests/codegen/rust-abi-arch-specific-adjustment.rs
index 87a7cd8ae26..9da10f662b0 100644
--- a/tests/codegen/rust-abi-arch-specific-adjustment.rs
+++ b/tests/codegen/rust-abi-arch-specific-adjustment.rs
@@ -1,93 +1,111 @@
 //@ compile-flags: -O -C no-prepopulate-passes
-//@ revisions: riscv64
+//@ revisions: riscv64 loongarch64
 
 //@[riscv64] only-riscv64
 //@[riscv64] compile-flags: --target riscv64gc-unknown-linux-gnu
 //@[riscv64] needs-llvm-components: riscv
 
+//@[loongarch64] only-loongarch64
+//@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
+//@[loongarch64] needs-llvm-components: loongarch
+
 #![crate_type = "lib"]
 
 #[no_mangle]
-// riscv64: define noundef i8 @arg_attr_u8(i8 noundef zeroext %x)
+// riscv64:     define noundef i8 @arg_attr_u8(i8 noundef zeroext %x)
+// loongarch64: define noundef i8 @arg_attr_u8(i8 noundef zeroext %x)
 pub fn arg_attr_u8(x: u8) -> u8 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i16 @arg_attr_u16(i16 noundef zeroext %x)
+// riscv64:     define noundef i16 @arg_attr_u16(i16 noundef zeroext %x)
+// loongarch64: define noundef i16 @arg_attr_u16(i16 noundef zeroext %x)
 pub fn arg_attr_u16(x: u16) -> u16 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i32 @arg_attr_u32(i32 noundef signext %x)
+// riscv64:     define noundef i32 @arg_attr_u32(i32 noundef signext %x)
+// loongarch64: define noundef i32 @arg_attr_u32(i32 noundef signext %x)
 pub fn arg_attr_u32(x: u32) -> u32 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i64 @arg_attr_u64(i64 noundef %x)
+// riscv64:     define noundef i64 @arg_attr_u64(i64 noundef %x)
+// loongarch64: define noundef i64 @arg_attr_u64(i64 noundef %x)
 pub fn arg_attr_u64(x: u64) -> u64 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i128 @arg_attr_u128(i128 noundef %x)
+// riscv64:     define noundef i128 @arg_attr_u128(i128 noundef %x)
+// loongarch64: define noundef i128 @arg_attr_u128(i128 noundef %x)
 pub fn arg_attr_u128(x: u128) -> u128 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i8 @arg_attr_i8(i8 noundef signext %x)
+// riscv64:     define noundef i8 @arg_attr_i8(i8 noundef signext %x)
+// loongarch64: define noundef i8 @arg_attr_i8(i8 noundef signext %x)
 pub fn arg_attr_i8(x: i8) -> i8 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i16 @arg_attr_i16(i16 noundef signext %x)
+// riscv64:     define noundef i16 @arg_attr_i16(i16 noundef signext %x)
+// loongarch64: define noundef i16 @arg_attr_i16(i16 noundef signext %x)
 pub fn arg_attr_i16(x: i16) -> i16 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i32 @arg_attr_i32(i32 noundef signext %x)
+// riscv64:     define noundef i32 @arg_attr_i32(i32 noundef signext %x)
+// loongarch64: define noundef i32 @arg_attr_i32(i32 noundef signext %x)
 pub fn arg_attr_i32(x: i32) -> i32 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i64 @arg_attr_i64(i64 noundef %x)
+// riscv64:     define noundef i64 @arg_attr_i64(i64 noundef %x)
+// loongarch64: define noundef i64 @arg_attr_i64(i64 noundef %x)
 pub fn arg_attr_i64(x: i64) -> i64 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef i128 @arg_attr_i128(i128 noundef %x)
+// riscv64:     define noundef i128 @arg_attr_i128(i128 noundef %x)
+// loongarch64: define noundef i128 @arg_attr_i128(i128 noundef %x)
 pub fn arg_attr_i128(x: i128) -> i128 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef zeroext i1 @arg_attr_bool(i1 noundef zeroext %x)
+// riscv64:     define noundef zeroext i1 @arg_attr_bool(i1 noundef zeroext %x)
+// loongarch64: define noundef zeroext i1 @arg_attr_bool(i1 noundef zeroext %x)
 pub fn arg_attr_bool(x: bool) -> bool {
     x
 }
 
 #[no_mangle]
 // ignore-tidy-linelength
-// riscv64: define noundef{{( range\(i32 0, 1114112\))?}} i32 @arg_attr_char(i32 noundef signext{{( range\(i32 0, 1114112\))?}} %x)
+// riscv64:     define noundef{{( range\(i32 0, 1114112\))?}} i32 @arg_attr_char(i32 noundef signext{{( range\(i32 0, 1114112\))?}} %x)
+// loongarch64: define noundef{{( range\(i32 0, 1114112\))?}} i32 @arg_attr_char(i32 noundef signext{{( range\(i32 0, 1114112\))?}} %x)
 pub fn arg_attr_char(x: char) -> char {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef float @arg_attr_f32(float noundef %x)
+// riscv64:     define noundef float @arg_attr_f32(float noundef %x)
+// loongarch64: define noundef float @arg_attr_f32(float noundef %x)
 pub fn arg_attr_f32(x: f32) -> f32 {
     x
 }
 
 #[no_mangle]
-// riscv64: define noundef double @arg_attr_f64(double noundef %x)
+// riscv64:     define noundef double @arg_attr_f64(double noundef %x)
+// loongarch64: define noundef double @arg_attr_f64(double noundef %x)
 pub fn arg_attr_f64(x: f64) -> f64 {
     x
 }
diff --git a/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs b/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs
index 259967e8918..71ccdc8ca62 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs
@@ -12,7 +12,7 @@ pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
     // CHECK:       Function Attrs: {{.*}}
     // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
     // CHECK:       start:
-    // CHECK-NEXT:  {{%.+}} = call i32 %f(i32 %arg)
+    // CHECK-NEXT:  {{%.+}} = call i32 %f(i32{{.*}} %arg)
     // CHECK-NEXT:  ret i32 {{%.+}}
     f(arg)
 }
diff --git a/tests/codegen/sanitizer/cfi/emit-type-checks.rs b/tests/codegen/sanitizer/cfi/emit-type-checks.rs
index 37edbefee56..ebc66a015df 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-checks.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-checks.rs
@@ -11,7 +11,7 @@ pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
     // CHECK:       [[TT:%.+]] = call i1 @llvm.type.test(ptr {{%f|%0}}, metadata !"{{[[:print:]]+}}")
     // CHECK-NEXT:  br i1 [[TT]], label %type_test.pass, label %type_test.fail
     // CHECK:       type_test.pass:
-    // CHECK-NEXT:  {{%.+}} = call i32 %f(i32 %arg)
+    // CHECK-NEXT:  {{%.+}} = call i32 %f(i32{{.*}} %arg)
     // CHECK:       type_test.fail:
     // CHECK-NEXT:  call void @llvm.trap()
     // CHECK-NEXT:  unreachable