2011-04-20 15:37:17 +00:00
|
|
|
; RUN: llc < %s -march=ptx32 | FileCheck %s
|
2011-03-14 11:26:01 +00:00
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_eq_u32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.eq.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp eq i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_ne_u32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.ne.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ne i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_lt_u32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.lt.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ult i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_le_u32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.le.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ule i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_gt_u32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.gt.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ugt i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_ge_u32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.ge.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp uge i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
2011-06-22 02:09:50 +00:00
|
|
|
define ptx_device i32 @test_setp_lt_s32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.lt.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp slt i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_le_s32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.le.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp sle i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_gt_s32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.gt.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp sgt i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_ge_s32_rr(i32 %x, i32 %y) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.ge.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp sge i32 %x, %y
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
2011-03-14 11:26:01 +00:00
|
|
|
define ptx_device i32 @test_setp_eq_u32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.eq.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 1;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp eq i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_ne_u32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.ne.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 1;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ne i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_lt_u32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.eq.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 0;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ult i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_le_u32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.lt.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 2;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ule i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_gt_u32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.gt.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 1;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp ugt i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_ge_u32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.ne.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 0;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-03-14 11:26:01 +00:00
|
|
|
%p = icmp uge i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
2011-04-02 08:51:39 +00:00
|
|
|
|
2011-06-22 02:09:50 +00:00
|
|
|
define ptx_device i32 @test_setp_lt_s32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.lt.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 1;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp slt i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_le_s32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.lt.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 2;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp sle i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_gt_s32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.gt.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 1;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp sgt i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_ge_s32_ri(i32 %x) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.gt.s32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 0;
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p[[P0]];
|
|
|
|
; CHECK: ret;
|
2011-06-22 02:09:50 +00:00
|
|
|
%p = icmp sge i32 %x, 1
|
|
|
|
%z = zext i1 %p to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
2011-04-02 08:51:39 +00:00
|
|
|
define ptx_device i32 @test_setp_4_op_format_1(i32 %x, i32 %y, i32 %u, i32 %v) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.gt.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, %r{{[0-9]+}};
|
|
|
|
; CHECK: setp.eq.and.u32 %p1, %r{{[0-9]+}}, %r{{[0-9]+}}, %p[[P0]];
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p1;
|
|
|
|
; CHECK: ret;
|
2011-04-02 08:51:39 +00:00
|
|
|
%c = icmp eq i32 %x, %y
|
|
|
|
%d = icmp ugt i32 %u, %v
|
|
|
|
%e = and i1 %c, %d
|
|
|
|
%z = zext i1 %e to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_setp_4_op_format_2(i32 %x, i32 %y, i32 %w) {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: setp.gt.u32 %p[[P0:[0-9]+]], %r{{[0-9]+}}, 0;
|
|
|
|
; CHECK: setp.eq.and.u32 %p1, %r{{[0-9]+}}, %r{{[0-9]+}}, !%p[[P0]];
|
|
|
|
; CHECK: selp.u32 %ret{{[0-9]+}}, 1, 0, %p1;
|
|
|
|
; CHECK: ret;
|
2011-04-02 08:51:39 +00:00
|
|
|
%c = trunc i32 %w to i1
|
|
|
|
%d = icmp eq i32 %x, %y
|
|
|
|
%e = xor i1 %c, 1
|
|
|
|
%f = and i1 %d, %e
|
|
|
|
%z = zext i1 %f to i32
|
|
|
|
ret i32 %z
|
|
|
|
}
|