This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +49
-4
lines changed
compiler/rustc_target/src/abi/call Expand file tree Collapse file tree 3 files changed +49
-4
lines changed Original file line number Diff line number Diff line change 11use crate :: abi:: call:: { ArgAbi , FnAbi , Reg } ;
2- use crate :: abi:: Abi ;
2+ use crate :: abi:: { Abi , Float , Primitive } ;
33
44// Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing
55
@@ -18,8 +18,12 @@ pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
1818 // FIXME(eddyb) there should be a size cap here
1919 // (probably what clang calls "illegal vectors").
2020 }
21- Abi :: Scalar ( _) => {
22- if a. layout . size . bytes ( ) > 8 {
21+ Abi :: Scalar ( scalar) => {
22+ // Match what LLVM does for `f128` so that `compiler-builtins` builtins match up
23+ // with what LLVM expects.
24+ if a. layout . size . bytes ( ) > 8
25+ && !matches ! ( scalar. primitive( ) , Primitive :: Float ( Float :: F128 ) )
26+ {
2327 a. make_indirect ( ) ;
2428 } else {
2529 a. extend_integer_width_to ( 32 ) ;
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ fn main() {
9494 // Unsupported <https://github.com/llvm/llvm-project/issues/94434>
9595 ( "arm64ec" , _) => false ,
9696 // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
97- ( "x86 " , "windows" ) => false ,
97+ ( "x86_64 " , "windows" ) => false ,
9898 // x86 has ABI bugs that show up with optimizations. This should be partially fixed with
9999 // the compiler-builtins update. <https://github.com/rust-lang/rust/issues/123885>
100100 ( "x86" | "x86_64" , _) => false ,
@@ -122,6 +122,8 @@ fn main() {
122122 ( "nvptx64" , _) => false ,
123123 // ABI unsupported <https://github.com/llvm/llvm-project/issues/41838>
124124 ( "sparc" , _) => false ,
125+ // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
126+ ( "x86_64" , "windows" ) => false ,
125127 // 64-bit Linux is about the only platform to have f128 symbols by default
126128 ( _, "linux" ) if target_pointer_width == 64 => true ,
127129 // Same as for f16, except MacOS is also missing f128 symbols.
Original file line number Diff line number Diff line change 1+ //@ assembly-output: emit-asm
2+ //@ compile-flags: -O
3+ //@ only-windows
4+ //@ only-x86_64
5+
6+ #![ feature( f16, f128) ]
7+ #![ crate_type = "lib" ]
8+
9+ // CHECK-LABEL: second_f16
10+ // CHECK: movaps %xmm1, %xmm0
11+ // CHECK-NEXT: retq
12+ #[ no_mangle]
13+ pub extern "C" fn second_f16 ( _: f16 , x : f16 ) -> f16 {
14+ x
15+ }
16+
17+ // CHECK-LABEL: second_f32
18+ // CHECK: movaps %xmm1, %xmm0
19+ // CHECK-NEXT: retq
20+ #[ no_mangle]
21+ pub extern "C" fn second_f32 ( _: f32 , x : f32 ) -> f32 {
22+ x
23+ }
24+
25+ // CHECK-LABEL: second_f64
26+ // CHECK: movaps %xmm1, %xmm0
27+ // CHECK-NEXT: retq
28+ #[ no_mangle]
29+ pub extern "C" fn second_f64 ( _: f64 , x : f64 ) -> f64 {
30+ x
31+ }
32+
33+ // CHECK-LABEL: second_f128
34+ // CHECK: movaps %xmm1, %xmm0
35+ // CHECK-NEXT: retq
36+ #[ no_mangle]
37+ pub extern "C" fn second_f128 ( _: f128 , x : f128 ) -> f128 {
38+ x
39+ }
You can’t perform that action at this time.
0 commit comments