JonPsson1 wrote:

Thanks for the help.

- new file extendhfdf2.c (and added to GENERIC_SOURCES list)
- $GENERIC_TF_SOURCES added to s390x_SOURCES.  This did not work immediately. 
However, if I removed the check for COMPILER_RT_HAS_FLOAT16 in the source 
files, it builds. Not sure why/if that is needed there (there is no check for 
it in e.g. extendhfdf2.c), or how it could be set.

Still problem with wrong-code: All conversions gave wrong-code when building 
compiler-rt with gcc, but when bootstrapping it (by using 
-DLLVM_ENABLE_RUNTIMES=compiler-rt), now only the double case fails. The clang 
assembly files are identical, but the libfunctions are different when I 
compared with libgcc (correct output) and compiler-rt. I stepped through my 
small program in gdb and found that as expected when returning from libgcc 
after the first extension, the register holds 1.5. When doing the same from 
compiler-rt it doesn't have the correct value. I checked that the ABI is 
correct at least - first instruction is moving f0 to r0, which seems right. At 
this point I wouldn't know what to look for to debug it further.

My test program:

```
#define T2 double

T2 __attribute__((noinline)) fun2(T2 Op0, T2 Op1) {
  return Op0 + Op1;
}

volatile _Float16 A;
volatile _Float16 B;
int main() {
  A = 1.5;
  B = 0.5;
  T2 Res2 = fun2(((T2) A), ((T2) B));
  _Float16 Res = ((_Float16) Res2);
  return Res < 1.0 ? 11 : 3;   // Res = 2.0 => return 3  
}

```
```
rm a.out test4.s; ./bin/clang -target s390x-linux-gnu -march=z16 ./test4.c -O3 
-o ./a.out --rtlib=libgcc -save-temps ; ./a.out; echo $?
3

rm a.out test4.s; ./bin/clang -target s390x-linux-gnu -march=z16 
../build/test4.c -O3 -o ./a.out --rtlib=compiler-rt -save-temps ; ./a.out; echo 
$?                         
11
```


https://github.com/llvm/llvm-project/pull/109164
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to