the patch athttps://gcc.gnu.org/ml/gcc-patches/2014-07/msg00961.html
actually has one glitch on if check.
thumb target is code size sensitive, the best solution is we set
"prefer_callee_reg_p" to
true if we know that shrink-wrap will be performanced if prefer_callee_reg_p is
true.
but unfortunately, shrink-wrap judegement is done after these code, so we
should always
prefer "r3" instead of "prefer_callee_reg_p" on thumb.
previously, the logic is wrong, everything pass check on A, will pass check on
B.
&& (TARGET_THUMB2
|| !(TARGET_LDRD && current_tune->prefer_ldrd_strd))) <=A
{
reg = 3;
if (!(TARGET_LDRD && current_tune->prefer_ldrd_strd)) <= B
prefer_callee_reg_p = true;
}
the condition check
if (!(TARGET_LDRD && current_tune->prefer_ldrd_strd))
should be
if (!TARGET_THUMB2)
it's not exposed before because my local toolchain is not configured with extra
cflags that
the default dejagnu env is still for old cpu like arm7, that testcases which
requrie_thumb2
are marked as UNSUPPORTTED. sorry for makeing trouble.
after this fix, the code behave as expected, we only play the
"prefer_callee_reg_p" trick
on arm32 target.
testcase regressions fixed
===
-FAIL: gcc.target/arm/pr43920-2.c object-size text <= 54
-FAIL: gcc.target/arm/pr45701-1.c scan-assembler push\t{r3
-FAIL: gcc.target/arm/pr45701-1.c scan-assembler-not r8
-FAIL: gcc.target/arm/pr45701-2.c scan-assembler push\t{r3
-FAIL: gcc.target/arm/pr45701-2.c scan-assembler-not r8
+PASS: gcc.target/arm/pr43920-2.c object-size text <= 54
+PASS: gcc.target/arm/pr45701-1.c scan-assembler push\t{r3
+PASS: gcc.target/arm/pr45701-1.c scan-assembler-not r8
+PASS: gcc.target/arm/pr45701-2.c scan-assembler push\t{r3
+PASS: gcc.target/arm/pr45701-2.c scan-assembler-not r8
and all those ira-shrink* testcases not affected, still all pass.
test done
===
* pass bootstrap on chromebook with both arm and thumb mode
* no regression on arm-none-eabi (configured with armv8-a) full toolchain test.
ok to install?
thanks,
Jiong
gcc/
* config/arm/arm.c (arm_get_frame_offsets): !(TARGET_LDRD &&
current_tune->prefer_ldrd_strd)
should be "!TARGET_THUMB2".
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 7e62ba5..4c8b2c2 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -20803,7 +20803,7 @@ arm_get_frame_offsets (void)
|| !(TARGET_LDRD && current_tune->prefer_ldrd_strd)))
{
reg = 3;
- if (!(TARGET_LDRD && current_tune->prefer_ldrd_strd))
+ if (!TARGET_THUMB2)
prefer_callee_reg_p = true;
}
if (reg == -1