Open Quuxplusone opened 5 years ago
Bugzilla Link | PR39092 |
Status | NEW |
Importance | P enhancement |
Reported by | Alex Bradbury (asb@lowrisc.org) |
Reported on | 2018-09-26 13:49:01 -0700 |
Last modified on | 2020-11-02 22:53:57 -0800 |
Version | trunk |
Hardware | PC All |
CC | fwage73@gmail.com, hfinkel@anl.gov, llvm-bugs@lists.llvm.org, shkzhang@cn.ibm.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
A target could fix things up in TgtISelDAGToDAG by retrieving the Function,
checking the attributes on the return type, and modifying the constant return
value if necessary.
However there's the same issue with constant, negative, anyext arguments:
declare void @callee(i16)
define void @caller() nounwind {
call void @callee(i16 -100)
ret void
}
In the general case, it's not really plausible to match a ConstantSDNode to the
original argument in the Function given the splitting that may have taken place
during legalisation.
Always sign-extending negative constant anyext arguments or return values would
be preferable for targets like PowerPC, ARM and RISC-V.
In fact,
lis 3, 0
ori 3, 3, 65436
is not equal
li 3, -100
Becuae the r3 register is different, the first pattern the high bits of r3 is
zero, but for the second, the higt bits of r3 is one.
They're not equal, but they're both valid lowerings because the return value is anyext.