eddyz87 wrote:

@yonghong-song , if I understand @efriedma-quic correctly (thank you for 
explanations), the following fragment is not RISC-V ABI conformant:

```
$ cat u.c
void foo(unsigned);
void bar(unsigned a, unsigned b) {
  foo(a + b);
}

       1:       67 02 00 00 20 00 00 00 r2 <<= 0x20
       2:       77 02 00 00 20 00 00 00 r2 >>= 0x20
       3:       bf 21 00 00 00 00 00 00 r1 = r2
       4:       85 10 00 00 ff ff ff ff call -0x1
```

The `r1` would be zero extended, while to be ABI conformant it has to be sign 
extended, as for RV64 the 31-st bit should be the same as upper 32 bits. The 
fact that decision to zero or sign extend the argument depends on the 
architecture means that this extension has to be done at JIT time (meaning that 
BTF is mandatory) or be a part of kfunc.

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

Reply via email to