diff options
author | Andrew Pinski <apinski@marvell.com> | 2023-05-20 21:01:46 -0700 |
---|---|---|
committer | Andrew Pinski <apinski@marvell.com> | 2023-05-20 21:06:28 -0700 |
commit | 7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b (patch) | |
tree | 2b17d543cc4551681863fe0c95270ef399ba886d /gcc | |
parent | 660754a820465583df32a5f9601df7389c941920 (diff) | |
download | gcc-7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b.zip gcc-7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b.tar.gz gcc-7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b.tar.bz2 |
Fix expand_single_bit_test for big-endian
I had thought extract_bit_field bitpos argument was the shifted position
and not the bitposition like BIT_FIELD_REF so I had removed the code which
would use the correct bitposition for BYTES_BIG_ENDIAN.
Committed as obvious; I checked big-endian MIPS to make sure we are now
producing the correct code.
gcc/ChangeLog:
* expr.cc (expand_single_bit_test): Correct bitpos for big-endian.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/expr.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc index 30c58c8..56b5187 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -12958,7 +12958,14 @@ expand_single_bit_test (location_t loc, enum tree_code code, rtx inner0 = expand_expr (inner, NULL_RTX, VOIDmode, EXPAND_NORMAL); - inner0 = extract_bit_field (inner0, 1, bitnum, 1, target, + int bitpos = bitnum; + + scalar_int_mode imode = as_a <scalar_int_mode>(GET_MODE (inner0)); + + if (BYTES_BIG_ENDIAN) + bitpos = GET_MODE_BITSIZE (imode) - 1 - bitpos; + + inner0 = extract_bit_field (inner0, 1, bitpos, 1, target, operand_mode, mode, 0, NULL); if (code == EQ_EXPR) |