aboutsummaryrefslogtreecommitdiff
path: root/mkdep
diff options
context:
space:
mode:
authorAlex Coplan <alex.coplan@arm.com>2020-09-07 15:20:21 +0100
committerAlex Coplan <alex.coplan@arm.com>2020-09-07 15:20:21 +0100
commitd4febc75e8dfab23bd3132d5747eded918f85107 (patch)
treefadcf0f96673852361863451a2deb435bb79b5a9 /mkdep
parent931832a5ccd92c7289f4933c42cf007e1a6b737f (diff)
downloadgcc-d4febc75e8dfab23bd3132d5747eded918f85107.zip
gcc-d4febc75e8dfab23bd3132d5747eded918f85107.tar.gz
gcc-d4febc75e8dfab23bd3132d5747eded918f85107.tar.bz2
aarch64: Don't emit invalid zero/sign-extend syntax
Given the following C function: double *f(double *p, unsigned x) { return p + x; } prior to this patch, GCC at -O2 would generate: f: add x0, x0, x1, uxtw 3 ret but this add instruction uses architecturally-invalid syntax: the width of the third operand conflicts with the width of the extension specifier. The third operand is only permitted to be an x register when the extension specifier is (u|s)xtx. This instruction, and analogous insns for adds, sub, subs, and cmp, are rejected by clang, but accepted by binutils. Assembling and disassembling such an insn with binutils gives the architecturally-valid version in the disassembly: 0: 8b214c00 add x0, x0, w1, uxtw #3 This patch fixes several patterns in the AArch64 backend to use the standard syntax as specified in the Arm ARM such that GCC's output can be assembled by assemblers other than GAS. --- gcc/ChangeLog: * config/aarch64/aarch64.md (*adds_<optab><ALLX:mode>_<GPI:mode>): Ensure extended operand agrees with width of extension specifier. (*subs_<optab><ALLX:mode>_<GPI:mode>): Likewise. (*adds_<optab><ALLX:mode>_shift_<GPI:mode>): Likewise. (*subs_<optab><ALLX:mode>_shift_<GPI:mode>): Likewise. (*add_<optab><ALLX:mode>_<GPI:mode>): Likewise. (*add_<optab><ALLX:mode>_shft_<GPI:mode>): Likewise. (*add_uxt<mode>_shift2): Likewise. (*sub_<optab><ALLX:mode>_<GPI:mode>): Likewise. (*sub_<optab><ALLX:mode>_shft_<GPI:mode>): Likewise. (*sub_uxt<mode>_shift2): Likewise. (*cmp_swp_<optab><ALLX:mode>_reg<GPI:mode>): Likewise. (*cmp_swp_<optab><ALLX:mode>_shft_<GPI:mode>): Likewise. gcc/testsuite/ChangeLog: * gcc.target/aarch64/adds3.c: Fix test w.r.t. new syntax. * gcc.target/aarch64/cmp.c: Likewise. * gcc.target/aarch64/subs3.c: Likewise. * gcc.target/aarch64/subsp.c: Likewise. * gcc.target/aarch64/extend-syntax.c: New test.
Diffstat (limited to 'mkdep')
0 files changed, 0 insertions, 0 deletions