blob: 3643ff19d1139779078589cae1f4e0d2c84b35fb [file] [log] [blame]
Brad Bishop26bdd442019-08-16 17:08:17 -04001From 2715b235b3db423bf35b9304a2ba5daa86b1680e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 18 Jan 2017 11:25:48 +0530
4Subject: [PATCH 28/54] [Patch, microblaze]: Correct the const high double
5 immediate value With this patch the loading of the DI mode immediate values
6 will be using REAL_VALUE_FROM_CONST_DOUBLE and REAL_VALUE_TO_TARGET_DOUBLE
7 functions, as CONST_DOUBLE_HIGH was returning the sign extension value even
8 of the unsigned long long constants also
9
10Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
11 Ajit Agarwal <ajitkum@xilinx.com>
12
13ChangeLog:
142016-02-03 Nagaraju Mekala <nmekala@xilix.com>
15 Ajit Agarwal <ajitkum@xilinx.com>
16
17 *microblaze.c (print_operand): Use REAL_VALUE_FROM_CONST_DOUBLE &
18 REAL_VALUE_TO_TARGET_DOUBLE
19 *long.c (new): Added new testcase
20---
21 gcc/config/microblaze/microblaze.c | 8 ++++++--
22 gcc/testsuite/gcc.target/microblaze/long.c | 10 ++++++++++
23 2 files changed, 16 insertions(+), 2 deletions(-)
24 create mode 100644 gcc/testsuite/gcc.target/microblaze/long.c
25
26diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
27index 3832d16..29cd54f 100644
28--- a/gcc/config/microblaze/microblaze.c
29+++ b/gcc/config/microblaze/microblaze.c
30@@ -2517,14 +2517,18 @@ print_operand (FILE * file, rtx op, int letter)
31 else if (letter == 'h' || letter == 'j')
32 {
33 long val[2];
34+ long l[2];
35 if (code == CONST_DOUBLE)
36 {
37 if (GET_MODE (op) == DFmode)
38 REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), val);
39 else
40 {
41- val[0] = CONST_DOUBLE_HIGH (op);
42- val[1] = CONST_DOUBLE_LOW (op);
43+ REAL_VALUE_TYPE rv;
44+ REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
45+ REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
46+ val[1] = l[WORDS_BIG_ENDIAN == 0];
47+ val[0] = l[WORDS_BIG_ENDIAN != 0];
48 }
49 }
50 else if (code == CONST_INT)
51diff --git a/gcc/testsuite/gcc.target/microblaze/long.c b/gcc/testsuite/gcc.target/microblaze/long.c
52new file mode 100644
53index 0000000..4d45186
54--- /dev/null
55+++ b/gcc/testsuite/gcc.target/microblaze/long.c
56@@ -0,0 +1,10 @@
57+/* { dg-options "-O0" } */
58+#define BASEADDR 0xF0000000ULL
59+int main ()
60+{
61+ unsigned long long start;
62+ start = (unsigned long long) BASEADDR;
63+ return 0;
64+}
65+/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0x00000000" } } */
66+/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0xf0000000" } } */
67--
682.7.4
69