[llvm-dev] Issue with extendhfsf2_test.c in compiler-rt

Romaric Jodin via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 24 02:15:00 PDT 2019


Hi all,

I have a issue when I'm running "extendhfsf2_test.c" (in
"compiler-rt/test/builtins/Unit") with llvm9.0.1.
I'm getting this output message (and the test return 1):

error in test__extendhfsf2(0x7e00) = nan, expected nan


I'm compile the test by hand ("clang -O2 extendhfsf2_test.c
-o extendhfsf2_test")
I've also looked at the generated asm code, and it seems that clang decided
at compile time that the test will fail as it will always print the message
and return 1 as shown below:

0000000000400580 main:
  400580: 50                            pushq   %rax
  400581: bf 00 7e 00 00                movl    $32256, %edi
  400586: e8 25 00 00 00                callq   37 <__extendhfsf2>
  40058b: f3 0f 5a c0                   cvtss2sd        %xmm0, %xmm0
  40058f: f2 0f 10 0d 21 01 00 00       movsd   289(%rip), %xmm1
  400597: bf c0 06 40 00                movl    $4196032, %edi
  40059c: be 00 7e 00 00                movl    $32256, %esi
  4005a1: b0 02                         movb    $2, %al
  4005a3: e8 58 fe ff ff                callq   -424 <printf at plt>
  4005a8: b8 01 00 00 00                movl    $1, %eax
  4005ad: 59                            popq    %rcx
  4005ae: c3                            retq
  4005af: 90                            nop


If I force the compiler to do the test at runtime (by adding a
"__attribute__((noinline))" at the right place in the code), the test
return with success.

Am I doing something wrong here? Or it is a known bug?

Thanks,
Romaric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191024/d2daa126/attachment.html>


More information about the llvm-dev mailing list