Skip to contentSkip to conversation

or1k: Fix struct return test

PATCH In review Stafford Horne 2 participants 3 messages May 31, 2025 – Jun 2, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 or1k: Fix struct return test

In or1k structs are returned from functions using the memory address passed in r3. In the current version of GCC the struct stores changed from r11 (the return value) to r3 the incoming memory address. Both of are valid.

Adjust the test to match what GCC is producing now.

gcc/testsuite/ChangeLog:

* gcc.target/or1k/return-2.c: Fix test.

---
 gcc/testsuite/gcc.target/or1k/return-2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gcc/testsuite/gcc.target/or1k/return-2.c +1 -1
index add3720c88e..c072ae23142 100644
@@ -16,4 +16,4 @@ struct a getstruct (long aa) {
 /* Ensure our return value is returned on stack.  */
 /* { dg-final { scan-assembler-not "r12," } } */
 /* { dg-final { scan-assembler "l.or\\s+r11, r3, r3" } } */
-/* { dg-final { scan-assembler-times "l.sw\\s+\\d+.r11.," 3 } } */
+/* { dg-final { scan-assembler-times "l.sw\\s+\\d+.r3.," 3 } } */
Signature · 1 line
2.49.0
#1 lore raw
Quoted 10 lines · Stafford Horne

In or1k structs are returned from functions using the memory address passed in r3. In the current version of GCC the struct stores changed from r11 (the return value) to r3 the incoming memory address. Both of are valid.

Adjust the test to match what GCC is producing now.

gcc/testsuite/ChangeLog:

* gcc.target/or1k/return-2.c: Fix test.

Given you're the maintainer of this port it seems like you can self-approve and commit this and the long jump offset patch.

Jeff

#2 lore raw
Quoted 8 lines · Jeff Law
Quoted 5 lines · Stafford Horne

In or1k structs are returned from functions using the memory address passed in r3. In the current version of GCC the struct stores changed from r11 (the return value) to r3 the incoming memory address. Both of are valid.

Quoted 7 lines
Quoted 5 lines

Adjust the test to match what GCC is producing now.

gcc/testsuite/ChangeLog:

* gcc.target/or1k/return-2.c: Fix test.

Given you're the maintainer of this port it seems like you can self-approve and commit this and the long jump offset patch.

Hi Jeff,

Thanks for checking, I usually just like to send out patches to give myself a bit of a cooling off period and allow anyone to spot obvious issues.

I have pushed these now.

-Stafford