diff options
author | YunQiang Su <yunqiang.su@cipunited.com> | 2021-10-11 06:42:39 -0400 |
---|---|---|
committer | YunQiang Su <syq@debian.org> | 2021-12-07 10:01:23 +0800 |
commit | 30a08286e67e3aee17347f8d02e8f868a995beb9 (patch) | |
tree | 3f72d4fda38abcffce68860861bfaa6040892f36 /gcc/config/mips/mips.h | |
parent | 3d9e6767939e9658260e2506e81ec32b37cba041 (diff) | |
download | gcc-30a08286e67e3aee17347f8d02e8f868a995beb9.zip gcc-30a08286e67e3aee17347f8d02e8f868a995beb9.tar.gz gcc-30a08286e67e3aee17347f8d02e8f868a995beb9.tar.bz2 |
MIPS: R6: load/store can process unaligned address
MIPS release 6 requires the lw/ld/sw/sd can work with
unaligned address, while it can be implemented by
full hardware or trap&emulate.
Since it doesn't have to be fully done by hardware, we add a
pair of options -m(no-)unaligned-access. Kernels may need them.
gcc/ChangeLog:
* config/mips/mips.h (ISA_HAS_UNALIGNED_ACCESS, STRICT_ALIGNMENT):
R6 can unaligned access.
* config/mips/mips.md (movmisalign<mode>): Likewise.
* config/mips/mips.opt: add -m(no-)unaligned-access
* doc/invoke.texi: Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/mips/mips.exp: add unaligned-access
* gcc.target/mips/unaligned-2.c: New test.
* gcc.target/mips/unaligned-3.c: New test.
Diffstat (limited to 'gcc/config/mips/mips.h')
-rw-r--r-- | gcc/config/mips/mips.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 973372e..34490bf 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -243,6 +243,10 @@ struct mips_cpu_info { && (mips_isa_rev >= 6 \ || ISA_HAS_MSA)) +/* ISA load/store instructions can handle unaligned address */ +#define ISA_HAS_UNALIGNED_ACCESS (TARGET_UNALIGNED_ACCESS \ + && (mips_isa_rev >= 6)) + /* The ISA compression flags that are currently in effect. */ #define TARGET_COMPRESSION (target_flags & (MASK_MIPS16 | MASK_MICROMIPS)) @@ -1684,7 +1688,7 @@ FP_ASM_SPEC "\ (ISA_HAS_MSA ? BITS_PER_MSA_REG : LONG_DOUBLE_TYPE_SIZE) /* All accesses must be aligned. */ -#define STRICT_ALIGNMENT 1 +#define STRICT_ALIGNMENT (!ISA_HAS_UNALIGNED_ACCESS) /* Define this if you wish to imitate the way many other C compilers handle alignment of bitfields and the structures that contain |