1 ; Test the Test Data Class instruction logic operation folding.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare i32 @llvm.s390.tdc.f32(float, i64)
6 declare i32 @llvm.s390.tdc.f64(double, i64)
7 declare i32 @llvm.s390.tdc.f128(fp128, i64)
10 define i32 @f1(float %x) {
13 ; CHECK-NEXT: ipm [[REG1:%r[0-9]+]]
14 ; CHECK-NEXT: risbg %r2, [[REG1]], 63, 191, 36
15 %a = call i32 @llvm.s390.tdc.f32(float %x, i64 3)
16 %b = call i32 @llvm.s390.tdc.f32(float %x, i64 6)
17 %a1 = icmp ne i32 %a, 0
18 %b1 = icmp ne i32 %b, 0
20 %xres = zext i1 %res to i32
25 define i32 @f2(double %x) {
28 ; CHECK-NEXT: ipm [[REG1:%r[0-9]+]]
29 ; CHECK-NEXT: risbg %r2, [[REG1]], 63, 191, 36
30 %a = call i32 @llvm.s390.tdc.f64(double %x, i64 3)
31 %b = call i32 @llvm.s390.tdc.f64(double %x, i64 6)
32 %a1 = icmp ne i32 %a, 0
33 %b1 = icmp ne i32 %b, 0
34 %res = and i1 %a1, %b1
35 %xres = zext i1 %res to i32
40 define i32 @f3(fp128 %x) {
43 ; CHECK-NEXT: ipm [[REG1:%r[0-9]+]]
44 ; CHECK-NEXT: risbg %r2, [[REG1]], 63, 191, 36
45 %a = call i32 @llvm.s390.tdc.f128(fp128 %x, i64 3)
46 %b = call i32 @llvm.s390.tdc.f128(fp128 %x, i64 6)
47 %a1 = icmp ne i32 %a, 0
48 %b1 = icmp ne i32 %b, 0
49 %res = xor i1 %a1, %b1
50 %xres = zext i1 %res to i32
54 ; Check using xor i1 - negated test
55 define i32 @f4(fp128 %x) {
57 ; CHECK: tcxb %f0, 4090
58 ; CHECK-NEXT: ipm [[REG1:%r[0-9]+]]
59 ; CHECK-NEXT: risbg %r2, [[REG1]], 63, 191, 36
60 %a = call i32 @llvm.s390.tdc.f128(fp128 %x, i64 3)
61 %b = call i32 @llvm.s390.tdc.f128(fp128 %x, i64 6)
62 %a1 = icmp ne i32 %a, 0
63 %b1 = icmp eq i32 %b, 0
64 %res = xor i1 %a1, %b1
65 %xres = zext i1 %res to i32
69 ; Check different first args
70 define i32 @f5(float %x, float %y) {
72 ; CHECK-NOT: tceb {{%f[0-9]+}}, 5
73 ; CHECK-DAG: tceb %f0, 3
74 ; CHECK-DAG: tceb %f2, 6
75 %a = call i32 @llvm.s390.tdc.f32(float %x, i64 3)
76 %b = call i32 @llvm.s390.tdc.f32(float %y, i64 6)
77 %a1 = icmp ne i32 %a, 0
78 %b1 = icmp ne i32 %b, 0
79 %res = xor i1 %a1, %b1
80 %xres = zext i1 %res to i32
84 ; Non-const mask (not supported)
85 define i32 @f6(float %x, i64 %y) {
87 ; CHECK-DAG: tceb %f0, 0(%r2)
88 ; CHECK-DAG: tceb %f0, 6
89 %a = call i32 @llvm.s390.tdc.f32(float %x, i64 %y)
90 %b = call i32 @llvm.s390.tdc.f32(float %x, i64 6)
91 %a1 = icmp ne i32 %a, 0
92 %b1 = icmp ne i32 %b, 0
93 %res = xor i1 %a1, %b1
94 %xres = zext i1 %res to i32