mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-02 15:51:54 +00:00
[XCore] Fix instruction selection for zext, mkmsk instructions.
r182680 replaced CountLeadingZeros_32 with a template function countLeadingZeros that relies on using the correct argument type to give the right result. The type passed in the XCore backend after this revision was incorrect in a couple of places. Patch by Robert Lytton. llvm-svn: 185430
This commit is contained in:
parent
83886dc182
commit
ad449c14dd
@ -115,7 +115,7 @@ SDNode *XCoreDAGToDAGISel::Select(SDNode *N) {
|
|||||||
if (immMskBitp(N)) {
|
if (immMskBitp(N)) {
|
||||||
// Transformation function: get the size of a mask
|
// Transformation function: get the size of a mask
|
||||||
// Look for the first non-zero bit
|
// Look for the first non-zero bit
|
||||||
SDValue MskSize = getI32Imm(32 - countLeadingZeros(Val));
|
SDValue MskSize = getI32Imm(32 - countLeadingZeros((uint32_t)Val));
|
||||||
return CurDAG->getMachineNode(XCore::MKMSK_rus, dl,
|
return CurDAG->getMachineNode(XCore::MKMSK_rus, dl,
|
||||||
MVT::i32, MskSize);
|
MVT::i32, MskSize);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ def msksize_xform : SDNodeXForm<imm, [{
|
|||||||
// Transformation function: get the size of a mask
|
// Transformation function: get the size of a mask
|
||||||
assert(isMask_32(N->getZExtValue()));
|
assert(isMask_32(N->getZExtValue()));
|
||||||
// look for the first non-zero bit
|
// look for the first non-zero bit
|
||||||
return getI32Imm(32 - countLeadingZeros(N->getZExtValue()));
|
return getI32Imm(32 - countLeadingZeros((uint32_t)N->getZExtValue()));
|
||||||
}]>;
|
}]>;
|
||||||
|
|
||||||
def neg_xform : SDNodeXForm<imm, [{
|
def neg_xform : SDNodeXForm<imm, [{
|
||||||
|
@ -9,3 +9,11 @@ define i32 @f() {
|
|||||||
entry:
|
entry:
|
||||||
ret i32 12345678
|
ret i32 12345678
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define i32 @g() {
|
||||||
|
entry:
|
||||||
|
; CHECK: g:
|
||||||
|
; CHECK: mkmsk r0, 1
|
||||||
|
; CHECK: retsp 0
|
||||||
|
ret i32 1;
|
||||||
|
}
|
||||||
|
10
test/CodeGen/XCore/zext.ll
Normal file
10
test/CodeGen/XCore/zext.ll
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
; RUN: llc -march=xcore < %s | FileCheck %s
|
||||||
|
|
||||||
|
define i32 @f(i1 %a) {
|
||||||
|
entry:
|
||||||
|
; CHECK: f
|
||||||
|
; CHECK: zext r0, 1
|
||||||
|
; CHECK: retsp 0
|
||||||
|
%b= zext i1 %a to i32
|
||||||
|
ret i32 %b
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user