File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ // Test for pclmulqdq intrinsics inlining across target_feature boundaries
2+ // Issue: https://github.com/rust-lang/rust/issues/139029
3+ //
4+ // When a function with target_feature calls another function without matching
5+ // target_feature attributes, the intrinsics may not inline properly, leading
6+ // to function calls instead of direct instructions.
7+
8+ //@ assembly-output: emit-asm
9+ //@ only-x86_64-unknown-linux-gnu
10+ //@ compile-flags: -C opt-level=3
11+
12+ #![ crate_type = "lib" ]
13+
14+ use std:: arch:: x86_64 as arch;
15+
16+ // CHECK-NOT: jmp
17+ // CHECK-NOT: call
18+ // CHECK: pclmulqdq
19+ // CHECK: ret
20+
21+ #[ target_feature( enable = "pclmulqdq" , enable = "sse2" , enable = "sse4.1" ) ]
22+ #[ no_mangle]
23+ pub unsafe fn reduce128_caller (
24+ a : arch:: __m128i ,
25+ b : arch:: __m128i ,
26+ keys : arch:: __m128i ,
27+ ) -> arch:: __m128i {
28+ reduce128 ( a, b, keys)
29+ }
30+
31+ unsafe fn reduce128 ( a : arch:: __m128i , b : arch:: __m128i , keys : arch:: __m128i ) -> arch:: __m128i {
32+ let t1 = arch:: _mm_clmulepi64_si128 ( a, keys, 0x00 ) ;
33+ let t2 = arch:: _mm_clmulepi64_si128 ( a, keys, 0x11 ) ;
34+ arch:: _mm_xor_si128 ( arch:: _mm_xor_si128 ( b, t1) , t2)
35+ }
You can’t perform that action at this time.
0 commit comments