[3/3] bpf: PROMOTE_MODE to SI not DI [PR124419] [do-not-merge]
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
fail
|
Patch failed to apply
|
Commit Message
Since BPF ISA allows 32-bit ops and extensions, smaller types can be
safely promoted to SImode (vs. DImode), thus following
- M = DImode; \
+ M = SImode;
Also it is desirable to keep SImode regs as is, thus promotion only
needs to be done for sub SImode values (vs. DImode), thus following
- && GET_MODE_SIZE (M) < 8) \
+ && GET_MODE_SIZE (M) < 4) \
This helps generate more wN regs. This is also part of the ABI change to
be addressed in PR/124171.
However currently this causes additional selftest failures which I'm
investigating, but figured I'll send it with the rest of the series on
same theme.
PR target/124419
gcc/ChangeLog:
* config/bpf/bpf.h (PROMOTE_MODE): Promote modes smaller than
SImode to SImode.
gcc/testsuite/ChangeLog:
* gcc.target/bpf/btfext-lineinfo.c: Adjust for codegen changes.
Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
---
gcc/config/bpf/bpf.h | 7 +++----
gcc/testsuite/gcc.target/bpf/btfext-lineinfo.c | 8 ++++----
2 files changed, 7 insertions(+), 8 deletions(-)
@@ -43,14 +43,13 @@
#define BITS_PER_WORD 64
#define UNITS_PER_WORD 8
-/* When storing an integer whose size is less than 64-bit in a
- register, promote it to a DImode. */
+/* Promote integer modes smaller than a word to SImode. */
#define PROMOTE_MODE(M, UNSIGNEDP, TYPE) \
do \
{ \
if (GET_MODE_CLASS (M) == MODE_INT \
- && GET_MODE_SIZE (M) < 8) \
- M = DImode; \
+ && GET_MODE_SIZE (M) < 4) \
+ M = SImode; \
} while (0)
/* Align argument parameters on the stack to 64-bit, at a minimum. */
@@ -38,12 +38,12 @@ int bar_func (struct T *t)
/* { dg-final { scan-assembler-times "btfext-lineinfo\.c.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
/* { dg-final { scan-assembler-times "4byte\[\t \]+\.LFB.\[\t \]+# insn_label" 2 } } */
-/* { dg-final { scan-assembler-times "4byte\[\t \]+LI.\[\t \]+# insn_label" 6 } } */
+/* { dg-final { scan-assembler-times "4byte\[\t \]+LI.\[\t \]+# insn_label" 8 } } */
-/* { dg-final { scan-assembler-times "# \\(line, col\\)" 8 } } */
+/* { dg-final { scan-assembler-times "# \\(line, col\\)" 10 } } */
/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(18, 5\\)" 1 } } */
-/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(20, 10\\)" 1 } } */
-/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(21, 18\\)" 1 } } */
+/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(20, 10\\)" 2 } } */
+/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(21, 18\\)" 2 } } */
/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(22, 1\\)" 1 } } */
/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(25, 5\\)" 1 } } */
/* { dg-final { scan-assembler-times "# \\(line, col\\) \\(28, 7\\)" 1 } } */