-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Fix RISC-V Test Failures in ./x test for Multiple Codegen and Assembly Cases #143915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f6ce29
cd818c7
cb80360
326780b
437b206
c162f6b
9273462
77e17ff
d464e57
2593e13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
repr_simd, | ||
arm_target_feature, | ||
mips_target_feature, | ||
s390x_target_feature | ||
s390x_target_feature, | ||
riscv_target_feature | ||
)] | ||
#![no_std] | ||
#![crate_type = "lib"] | ||
|
@@ -25,97 +26,105 @@ pub struct u32x16([u32; 16]); | |
pub struct i8x16([i8; 16]); | ||
|
||
// CHECK-LABEL: dyn_simd_extract | ||
// CHECK: extractelement <16 x i8> %x, i32 %idx | ||
// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 %idx | ||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 { | ||
simd_extract_dyn(x, idx) | ||
} | ||
|
||
// CHECK-LABEL: literal_dyn_simd_extract | ||
// CHECK: extractelement <16 x i8> %x, i32 7 | ||
// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 7 | ||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 { | ||
simd_extract_dyn(x, 7) | ||
} | ||
|
||
// CHECK-LABEL: const_dyn_simd_extract | ||
// CHECK: extractelement <16 x i8> %x, i32 7 | ||
// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 7 | ||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 { | ||
simd_extract_dyn(x, const { 3 + 4 }) | ||
} | ||
|
||
// CHECK-LABEL: const_simd_extract | ||
// CHECK: extractelement <16 x i8> %x, i32 7 | ||
// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 7 | ||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 { | ||
simd_extract(x, const { 3 + 4 }) | ||
} | ||
|
||
// CHECK-LABEL: dyn_simd_insert | ||
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 %idx | ||
// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 %idx | ||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 { | ||
simd_insert_dyn(x, idx, e) | ||
} | ||
|
||
// CHECK-LABEL: literal_dyn_simd_insert | ||
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 | ||
// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 7 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: if you're not going to consume the variable again later (by mentioning |
||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { | ||
simd_insert_dyn(x, 7, e) | ||
} | ||
|
||
// CHECK-LABEL: const_dyn_simd_insert | ||
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 | ||
// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 7 | ||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { | ||
simd_insert_dyn(x, const { 3 + 4 }, e) | ||
} | ||
|
||
// CHECK-LABEL: const_simd_insert | ||
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 | ||
// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 7 | ||
#[no_mangle] | ||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||
unsafe extern "C" fn const_simd_insert(x: i8x16, e: i8) -> i8x16 { | ||
simd_insert(x, const { 3 + 4 }, e) | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ | |||||
#![crate_type = "lib"] | ||||||
#![feature(no_core, repr_simd, arm_target_feature, mips_target_feature, s390x_target_feature)] | ||||||
#![no_core] | ||||||
#![feature(riscv_target_feature)] | ||||||
extern crate minicore; | ||||||
|
||||||
use minicore::*; | ||||||
|
@@ -79,7 +80,7 @@ pub fn bool_to_fake_bool_signed(b: bool) -> FakeBoolSigned { | |||||
unsafe { mem::transmute(b) } | ||||||
} | ||||||
|
||||||
// CHECK-LABEL: define{{.*}}i1 @fake_bool_signed_to_bool(i8 %b) | ||||||
// CHECK-LABEL: define{{.*}}i1 @fake_bool_signed_to_bool(i8 {{.*}}%b) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least for things like this one that aren't about SIMD, the point of having the signature is basically just to make it easier to read the verifications and check that the argument has the expected name (as opposed to being called So for things like that, I think ignoring extra flags in here is acceptable -- though admittedly slightly unusual because it's a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, though if it's just an optional extension flag, consider using
Suggested change
because you know exactly what you're ignoring in this case, rather than allowing for arbitrary future attributes that might be added by the optimizer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, that's very helpful! |
||||||
// CHECK: %_0 = trunc nuw i8 %b to i1 | ||||||
// CHECK-NEXT: ret i1 %_0 | ||||||
#[no_mangle] | ||||||
|
@@ -110,34 +111,36 @@ pub fn fake_bool_unsigned_to_bool(b: FakeBoolUnsigned) -> bool { | |||||
#[repr(simd)] | ||||||
struct S([i64; 1]); | ||||||
|
||||||
// CHECK-LABEL: define{{.*}}i64 @single_element_simd_to_scalar(<1 x i64> %b) | ||||||
// CHECK-LABEL: define{{.*}}i64 @single_element_simd_to_scalar({{.*}}i64{{.*}}%{{.*}}) | ||||||
// CHECK-NEXT: start: | ||||||
// CHECK-NEXT: %[[RET:.+]] = alloca [8 x i8] | ||||||
// CHECK-NEXT: store <1 x i64> %b, ptr %[[RET]] | ||||||
// CHECK-NEXT: %[[TEMP:.+]] = load i64, ptr %[[RET]] | ||||||
// CHECK-NEXT: ret i64 %[[TEMP]] | ||||||
// CHECK: store <1 x i64> %[[TEMP:.+]], ptr %[[RET]] | ||||||
// CHECK: %[[TEMP:.+]] = load i64, ptr %[[RET]] | ||||||
// CHECK: ret i64 %[[TEMP]] | ||||||
#[no_mangle] | ||||||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||||||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||||||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||||||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||||||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||||||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||||||
pub extern "C" fn single_element_simd_to_scalar(b: S) -> i64 { | ||||||
unsafe { mem::transmute(b) } | ||||||
} | ||||||
|
||||||
// CHECK-LABEL: define{{.*}}<1 x i64> @scalar_to_single_element_simd(i64 %b) | ||||||
// CHECK-LABEL: define{{.*}}i64{{.*}} @scalar_to_single_element_simd(i64 %b) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm less sure what should be done for this case. Is it even |
||||||
// CHECK-NEXT: start: | ||||||
// CHECK-NEXT: %[[RET:.+]] = alloca [8 x i8] | ||||||
// CHECK-NEXT: store i64 %b, ptr %[[RET]] | ||||||
// CHECK-NEXT: %[[TEMP:.+]] = load <1 x i64>, ptr %[[RET]] | ||||||
// CHECK-NEXT: ret <1 x i64> %[[TEMP]] | ||||||
// CHECK-NEXT: %[[TEMP:.+]] = load{{.*}}i64{{.*}}, ptr %[[RET]] | ||||||
// CHECK-NEXT: ret {{.*}}i64{{.*}}%[[TEMP]] | ||||||
#[no_mangle] | ||||||
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] | ||||||
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] | ||||||
#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] | ||||||
#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] | ||||||
#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] | ||||||
#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] | ||||||
pub extern "C" fn scalar_to_single_element_simd(b: i64) -> S { | ||||||
unsafe { mem::transmute(b) } | ||||||
} |
Uh oh!
There was an error while loading. Please reload this page.