[binutils-gdb] Fix a problem building the ARM assembler using LLVM.

Nick Clifton nickc@sourceware.org
Mon Feb 1 14:33:00 GMT 2016


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4f1d62057fa4894e504458027ac3228404144f7d

commit 4f1d62057fa4894e504458027ac3228404144f7d
Author: Loria <Loria@phantasia.org>
Date:   Mon Feb 1 14:32:25 2016 +0000

    Fix a problem building the ARM assembler using LLVM.
    
    	PR target/19311
    	* config/tc-arm.c (encode_arm_immediate): Recode to improve
    	efficiency and avoid an LLVM loop optimization bug.

Diff:
---
 gas/ChangeLog       | 6 ++++++
 gas/config/tc-arm.c | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 027b556..6e7319d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-01  Loria  <Loria@phantasia.org>
+
+	PR target/19311
+	* config/tc-arm.c (encode_arm_immediate): Recode to improve
+	efficiency and avoid an LLVM loop optimization bug.
+
 2016-02-01  Nick Clifton  <nickc@redhat.com>
 
 	* config/tc-microblaze.c (parse_imm): Fix compile time warning
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 4a16267..055e525 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -7268,7 +7268,10 @@ encode_arm_immediate (unsigned int val)
 {
   unsigned int a, i;
 
-  for (i = 0; i < 32; i += 2)
+  if (val <= 0xff)
+    return val;
+
+  for (i = 2; i < 32; i += 2)
     if ((a = rotate_left (val, i)) <= 0xff)
       return a | (i << 7); /* 12-bit pack: [shift-cnt,const].  */



More information about the Binutils-cvs mailing list