mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-16 23:19:37 +00:00
Fix a bug where we were useing HA to get the high part, which seems like it
could cause a miscompile. Fixing this didn't fix the two programs that fail though. :( This also changes the implementation to follow the pattern selector more closely, causing us to select 0 to li instead of lis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
50ff55c2c7
commit
393ecd6d2d
@ -685,22 +685,21 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
|
||||
case ISD::Constant: {
|
||||
assert(N->getValueType(0) == MVT::i32);
|
||||
unsigned v = (unsigned)cast<ConstantSDNode>(N)->getValue();
|
||||
unsigned Hi = HA16(v);
|
||||
unsigned Lo = Lo16(v);
|
||||
|
||||
// NOTE: This doesn't use SelectNodeTo, because doing that will prevent
|
||||
// folding shared immediates into other the second instruction that
|
||||
// uses it.
|
||||
if (Hi && Lo) {
|
||||
SDOperand Top = CurDAG->getTargetNode(PPC::LIS, MVT::i32,
|
||||
getI32Imm(v >> 16));
|
||||
return CurDAG->getTargetNode(PPC::ORI, MVT::i32, Top,
|
||||
getI32Imm(v & 0xFFFF));
|
||||
} else if (Lo) {
|
||||
if (isInt16(v))
|
||||
return CurDAG->getTargetNode(PPC::LI, MVT::i32, getI32Imm(v));
|
||||
} else {
|
||||
return CurDAG->getTargetNode(PPC::LIS, MVT::i32, getI32Imm(v >> 16));
|
||||
}
|
||||
|
||||
unsigned Hi = Hi16(v);
|
||||
unsigned Lo = Lo16(v);
|
||||
|
||||
if (!Lo)
|
||||
return CurDAG->getTargetNode(PPC::LIS, MVT::i32, getI32Imm(Hi));
|
||||
|
||||
SDOperand Top = CurDAG->getTargetNode(PPC::LIS, MVT::i32, getI32Imm(Hi));
|
||||
return CurDAG->getTargetNode(PPC::ORI, MVT::i32, Top, getI32Imm(Lo));
|
||||
}
|
||||
case ISD::UNDEF:
|
||||
if (N->getValueType(0) == MVT::i32)
|
||||
|
Loading…
x
Reference in New Issue
Block a user