[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
Nate Begeman
natebegeman at mac.com
Wed Nov 17 20:57:04 PST 2004
Changes in directory llvm/lib/Target/PowerPC:
PPC32ISelSimple.cpp updated: 1.102 -> 1.103
---
Log message:
Clean up and fix cast codegen by removing cases that are handled elsewhere,
and properly emitting signed short to unsigned int. This fixes the last
regression vs. the CBE, MultiSource/Applications/hbd.
---
Diffs of the changes: (+8 -19)
Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.102 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.103
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.102 Sun Nov 7 20:25:40 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Wed Nov 17 22:56:53 2004
@@ -3561,16 +3561,11 @@
// handle { byte, short, int } x { byte, short, int }
switch (SrcClass) {
case cByte:
- if (DestClass == cByte)
- BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg);
- else
- BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg);
+ BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg);
break;
case cShort:
if (DestClass == cByte)
BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg);
- else if (DestClass == cShort)
- BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg);
else
BuildMI(*MBB, IP, PPC::EXTSH, 1, DestReg).addReg(SrcReg);
break;
@@ -3608,19 +3603,13 @@
// handle u{ byte, short, int } -> { byte, short, int }
switch (SrcClass) {
case cByte:
- if (DestClass == cByte)
- // uByte 255 -> signed byte == -1
- BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg);
- else
- // uByte 255 -> signed short/int == 255
- BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg).addImm(0)
- .addImm(24).addImm(31);
+ // uByte 255 -> signed short/int == 255
+ BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg).addImm(0)
+ .addImm(24).addImm(31);
break;
case cShort:
if (DestClass == cByte)
BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg);
- else if (DestClass == cShort)
- BuildMI(*MBB, IP, PPC::EXTSH, 1, DestReg).addReg(SrcReg);
else
BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg).addImm(0)
.addImm(16).addImm(31);
@@ -3660,14 +3649,14 @@
unsigned clearBits = (DestClass == cByte) ? 24 : 16;
switch (SrcClass) {
case cByte:
+ BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg);
+ break;
case cShort:
- if (DestClass == cByte || DestClass == cShort)
- // sbyte -1 -> ubyte 0x000000FF
+ if (DestClass == cByte)
BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg)
.addImm(0).addImm(clearBits).addImm(31);
else
- // sbyte -1 -> ubyte 0xFFFFFFFF
- BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg);
+ BuildMI(*MBB, IP, PPC::EXTSH, 1, DestReg).addReg(SrcReg);
break;
case cLong:
++SrcReg;
More information about the llvm-commits
mailing list