Commit bdbe4023 by Jan Voung

Change some tests to be valid PNaCl IR (parameter type from i1 -> i32).

Change the i1 zeroext parameter to an explicit zext and i32. Add an assert in lowerCall that the type is at least 32-bits. I ended up putting the assert in lowerCall instead of InstX8632Push, since technically there are quite a few modes that push allows: 16-bit reg/mem (just not 8-bit reg/mem) and 8/16/32 bit constants. BUG=none R=stichnot@chromium.org Review URL: https://codereview.chromium.org/339933004
parent 44712d15
......@@ -1281,6 +1281,8 @@ void TargetX8632::lowerCall(const InstCall *Instr) {
_mov(T, Arg);
_push(T);
} else {
// Otherwise PNaCl requires parameter types to be at least 32-bits.
assert(Arg->getType() == IceType_f32 || Arg->getType() == IceType_i32);
_push(Arg);
}
StackOffset += typeWidthInBytesOnStack(Arg->getType());
......
......@@ -9,11 +9,12 @@
define void @testBool(i32 %a, i32 %b) {
entry:
%cmp = icmp eq i32 %a, %b
tail call void @use(i1 %cmp)
%cmp_ext = zext i1 %cmp to i32
tail call void @use(i32 %cmp_ext)
ret void
}
declare void @use(i1 zeroext) #1
declare void @use(i32)
; CHECK-NOT: ICE translation error
; ERRORS-NOT: ICE translation error
......
......@@ -14,21 +14,23 @@ entry:
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @use(i1 %cmp)
%cmp_ext = zext i1 %cmp to i32
tail call void @use(i32 %cmp_ext)
br label %if.end
if.end: ; preds = %if.then, %entry
br i1 %cmp1, label %if.then5, label %if.end7
if.then5: ; preds = %if.end
tail call void @use(i1 %cmp1)
%cmp1_ext = zext i1 %cmp1 to i32
tail call void @use(i32 %cmp1_ext)
br label %if.end7
if.end7: ; preds = %if.then5, %if.end
ret void
}
declare void @use(i1 zeroext)
declare void @use(i32)
; CHECK: .globl testBool
; Two bool computations
......
......@@ -59,6 +59,18 @@ entry:
; CHECK: push 123
; CHECK: call ignoreFpArgsNoInline
define internal i32 @passFp32ConstArg(float %a) {
entry:
%call = call i32 @ignoreFp32ArgsNoInline(float %a, i32 123, float 2.0)
ret i32 %call
}
; CHECK: passFp32ConstArg:
; CHECK: push dword
; CHECK: push 123
; CHECK: call ignoreFp32ArgsNoInline
declare i32 @ignoreFp32ArgsNoInline(float, i32, float)
define internal float @returnFloatArg(float %a) {
entry:
ret float %a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment