Hello All, This patch will load the DI mode immediate values from REAL_VALUE_FROM_CONST_DOUBLE and REAL_VALUE_TO_TARGET_DOUBLE functions, as CONST_DOUBLE_HIGH was returning the sign extension value even for the unsigned long long constants also
gcc/ChangeLog: * config/microblaze/microblaze.c (print_operand): Update loading of DI mode immediate values using REAL_VALUE_FROM_CONST_DOUBLE and REAL_VALUE_TO_TARGET_DOUBLE gcc/testsuite/ChangeLog: * gcc.target/microblaze/long.c: New test. --- gcc/ChangeLog | 6 ++++++ gcc/config/microblaze/microblaze.c | 9 ++++++--- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/microblaze/long.c | 10 ++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/microblaze/long.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a4c4f6..f28ebf7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2020-11-09 Nagaraju Mekala <nmek...@xilix.com> + + * config/microblaze/microblaze.c (print_operand): Update loading + of DI mode immediate values using REAL_VALUE_FROM_CONST_DOUBLE + and REAL_VALUE_TO_TARGET_DOUBLE + 2020-11-08 David Edelsohn <dje....@gmail.com> * config/rs6000/rs6000.c (rs6000_mangle_decl_assembler_name): Change diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index a0f81b7..d9341ec 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -2440,15 +2440,18 @@ print_operand (FILE * file, rtx op, int letter) else if (letter == 'h' || letter == 'j') { - long val[2]; + long val[2], l[2]; if (code == CONST_DOUBLE) { if (GET_MODE (op) == DFmode) REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), val); else { - val[0] = CONST_DOUBLE_HIGH (op); - val[1] = CONST_DOUBLE_LOW (op); + REAL_VALUE_TYPE rv; + REAL_VALUE_FROM_CONST_DOUBLE (rv, op); + REAL_VALUE_TO_TARGET_DOUBLE (rv, l); + val[1] = l[WORDS_BIG_ENDIAN == 0]; + val[0] = l[WORDS_BIG_ENDIAN != 0]; } } else if (code == CONST_INT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cff8ccf..081be8f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-11-09 Nagaraju Mekala <nmek...@xilinx.com> + + * gcc.target/microblaze/long.c: New test. + 2020-11-08 Iain Sandoe <i...@sandoe.co.uk> * obj-c++.dg/property/at-property-4.mm: Test handling class diff --git a/gcc/testsuite/gcc.target/microblaze/long.c b/gcc/testsuite/gcc.target/microblaze/long.c new file mode 100644 index 0000000..4d45186 --- /dev/null +++ b/gcc/testsuite/gcc.target/microblaze/long.c @@ -0,0 +1,10 @@ +/* { dg-options "-O0" } */ +#define BASEADDR 0xF0000000ULL +int main () +{ + unsigned long long start; + start = (unsigned long long) BASEADDR; + return 0; +} +/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0x00000000" } } */ +/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0xf0000000" } } */ -- 1.8.3.1 Attached is the patch. Thanks, Nagaraju
0001-Patch-microblaze-Correct-the-const-high-double-immed.patch
Description: 0001-Patch-microblaze-Correct-the-const-high-double-immed.patch