@@ -23,20 +23,24 @@ pub(crate) fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'
23
23
// (probably what clang calls "illegal vectors").
24
24
}
25
25
BackendRepr :: Scalar ( scalar) => {
26
- if is_ret && matches ! ( scalar. primitive( ) , Primitive :: Int ( Integer :: I128 , _) ) {
26
+ if is_ret
27
+ && matches ! (
28
+ scalar. primitive( ) ,
29
+ Primitive :: Int ( Integer :: I128 , _) | Primitive :: Float ( Float :: F128 )
30
+ )
31
+ {
32
+ // i128 and f128 have the same ABI on Windows.
27
33
if cx. target_spec ( ) . rustc_abi == Some ( RustcAbi :: X86Softfloat ) {
28
- // Use the native `i128` LLVM type for the softfloat ABI -- in other words, adjust nothing.
34
+ // Use the native `i128`/`f128` LLVM type for the softfloat ABI -- in other
35
+ // words, adjust nothing.
29
36
} else {
30
- // `i128` is returned in xmm0 by Clang and GCC
37
+ // `i128` and `f128` are returned in xmm0 by Clang. `i128` is returned in
38
+ // xmm0 by GCC but `f128` is indirect (Clang and GCC have a mismatch).
31
39
// FIXME(#134288): This may change for the `-msvc` targets in the future.
32
40
let reg = Reg { kind : RegKind :: Vector , size : Size :: from_bits ( 128 ) } ;
33
41
a. cast_to ( reg) ;
34
42
}
35
- } else if a. layout . size . bytes ( ) > 8
36
- && !matches ! ( scalar. primitive( ) , Primitive :: Float ( Float :: F128 ) )
37
- {
38
- // Match what LLVM does for `f128` so that `compiler-builtins` builtins match up
39
- // with what LLVM expects.
43
+ } else if a. layout . size . bytes ( ) > 8 {
40
44
a. make_indirect ( ) ;
41
45
} else {
42
46
a. extend_integer_width_to ( 32 ) ;
0 commit comments