bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/19311] arm-linux-as build on Mac OS X with Xcode7 fails to


From: Loria at phantasia dot org
Subject: [Bug binutils/19311] arm-linux-as build on Mac OS X with Xcode7 fails to assemble code from FreePascal cross-compiler
Date: Wed, 27 Jan 2016 18:56:51 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=19311

--- Comment #12 from Loria <Loria at phantasia dot org> ---
Well the optimzer removed all my tries to tell the optimizer to not unrolling
the loop the way it did. adding print("%d",i) will stop the loop unroller.
(I tryed all sorts of things, also your sugestion using an inline function
instead of the macro. The clang optimizer completly removed the inlinefunction
to form the same as with the macro ...)

I also crosschecked with 32bit which has the same issue.

I was successful with the following, which actually pulls us around the bug,
since we exit the funktion befor entering the loop.
<-
unsigned int
encode_arm_immediate (unsigned int val)
{
  unsigned int a, i;

  if(val <= 0xFF)
    return val;

  for (i = 0; i < 32 ; i += 2)
    if((a = rotate_left (val, i)) <= 0xFF)
      return a | (i << 7) ; /* 12-bit pack: [shift-cnt,const].  */
  return FAIL;
}
<-
this would now work as we need it. It wont stop the clang bug to hit somewhere
else. 
I also was successful in compiling the original function with:
gcc -O2 -fno-unroll-loops -fbracket-depth=1024 test.c 
if ppl want to be on the safe side, they should add -fno-unroll-loops all
others could use the "risky" version and only use the workaround ..

I could produce a patch to binutils 2.25.1 or head of git ... if you would like
to have the workaround within binutils .. it seems to have been done with
encode_thumb32_immediate (unsigned int val) already. The main loop is similar.

I filed a bugreport at the LLVM.Org ..

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]