================
@@ -37,6 +38,11 @@ struct empty f_empty(struct empty x) { return x; }
 // CHECK-LABEL: define{{.*}} i64 @f_emptyarr(i64 %x.coerce)
 struct empty f_emptyarr(struct emptyarr x) { return x.a[0]; }
 
+// CHECK-LABEL: define{{.*}} i64 @f_emptystackarg(i64 %a0.coerce, i64 
%a1.coerce, i64 %a2.coerce, i64 %a3.coerce, i64 %a4.coerce, i64 %a5.coerce, 
%struct.empty %a6.coerce, %struct.empty %a7.coerce)
+struct empty f_emptystackarg(struct empty a0, struct empty a1, struct empty 
a2, struct empty a3, struct empty a4, struct empty a5, struct empty a6, struct 
empty a7) {
+    return a7;
+}
----------------
folkertdev wrote:

With this PR, clang gets that wrong, this is the status quo

https://godbolt.org/z/cfnfYbYbW

```c
struct E {};

float f(struct E, struct E, struct E, struct E,
        struct E, struct E, struct E, float v) {
  return v;
}
```

gives with clang

```asm
f:
        fmovs %f15, %f0
        retl
        nop
```

and gcc 

```asm
f:
        save    %sp, -176, %sp
        return  %i7+8
         fmovs  %f15, %f0
```

with this fix, compiled with `~/c/llvm-project/build/bin/clang -S foo.c -target 
sparc64-unknown-linux-gnu -O1` I get

```asm
f:                                      ! @f
! %bb.0:                                ! %entry
        fmovs %f13, %f0
        retl
        nop
```

So, the wrong float register is used.

In the godbolt, if you add another `struct E` parameter the register used 
changes, with your PR it stays the same.

https://github.com/llvm/llvm-project/pull/217065
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to