2013-05-28 10:41:11 +00:00
|
|
|
; Test all condition-code masks that are relevant for CGRJ.
|
|
|
|
;
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
|
|
|
|
|
2013-06-27 09:49:34 +00:00
|
|
|
declare i64 @foo()
|
2013-05-28 10:41:11 +00:00
|
|
|
|
2013-07-12 09:17:10 +00:00
|
|
|
; Test EQ.
|
2013-05-28 10:41:11 +00:00
|
|
|
define void @f1(i64 %target) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f1:
|
2013-05-28 10:41:11 +00:00
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrje %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp eq i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 09:17:10 +00:00
|
|
|
; Test NE.
|
2013-05-28 10:41:11 +00:00
|
|
|
define void @f2(i64 %target) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f2:
|
2013-05-28 10:41:11 +00:00
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjlh %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp ne i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 09:17:10 +00:00
|
|
|
; Test SLE.
|
2013-05-28 10:41:11 +00:00
|
|
|
define void @f3(i64 %target) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f3:
|
2013-05-28 10:41:11 +00:00
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjle %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp sle i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 09:17:10 +00:00
|
|
|
; Test SLT.
|
2013-05-28 10:41:11 +00:00
|
|
|
define void @f4(i64 %target) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f4:
|
2013-05-28 10:41:11 +00:00
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjl %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp slt i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 09:17:10 +00:00
|
|
|
; Test SGT.
|
2013-05-28 10:41:11 +00:00
|
|
|
define void @f5(i64 %target) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f5:
|
2013-05-28 10:41:11 +00:00
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjh %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp sgt i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 09:17:10 +00:00
|
|
|
; Test SGE.
|
2013-05-28 10:41:11 +00:00
|
|
|
define void @f6(i64 %target) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f6:
|
2013-05-28 10:41:11 +00:00
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjhe %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp sge i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
2013-07-12 09:17:10 +00:00
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i32 EQ.
|
|
|
|
define i64 @f7(i64 %a, i64 %b) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f7:
|
2013-10-16 11:10:55 +00:00
|
|
|
; CHECK: ipm [[REG:%r[0-5]]]
|
|
|
|
; CHECK: afi [[REG]], -268435456
|
|
|
|
; CHECK: sra [[REG]], 31
|
2013-07-12 09:17:10 +00:00
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp eq <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i32>
|
|
|
|
%ret = bitcast <2 x i32> %ext to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i32 NE.
|
|
|
|
define i64 @f8(i64 %a, i64 %b) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f8:
|
2013-10-16 11:10:55 +00:00
|
|
|
; CHECK: ipm [[REG:%r[0-5]]]
|
|
|
|
; CHECK: afi [[REG]], 1879048192
|
|
|
|
; CHECK: sra [[REG]], 31
|
2013-07-12 09:17:10 +00:00
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp ne <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i32>
|
|
|
|
%ret = bitcast <2 x i32> %ext to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i64 EQ.
|
|
|
|
define void @f9(i64 %a, i64 %b, <2 x i64> *%dest) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f9:
|
2013-10-16 11:10:55 +00:00
|
|
|
; CHECK: ipm [[REG:%r[0-5]]]
|
|
|
|
; CHECK: afi [[REG]], -268435456
|
|
|
|
; CHECK: sllg [[REG2:%r[0-5]]], [[REG]], 32
|
|
|
|
; CHECK: srag {{%r[0-5]}}, [[REG2]], 63
|
2013-07-12 09:17:10 +00:00
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp eq <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i64>
|
|
|
|
store <2 x i64> %ext, <2 x i64> *%dest
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i64 NE.
|
|
|
|
define void @f10(i64 %a, i64 %b, <2 x i64> *%dest) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f10:
|
2013-10-16 11:10:55 +00:00
|
|
|
; CHECK: ipm [[REG:%r[0-5]]]
|
|
|
|
; CHECK: afi [[REG]], 1879048192
|
|
|
|
; CHECK: sllg [[REG2:%r[0-5]]], [[REG]], 32
|
|
|
|
; CHECK: srag {{%r[0-5]}}, [[REG2]], 63
|
2013-07-12 09:17:10 +00:00
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp ne <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i64>
|
|
|
|
store <2 x i64> %ext, <2 x i64> *%dest
|
|
|
|
ret void
|
|
|
|
}
|