1 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4 ; Check comparisons with zero. If the tested value is live after the
5 ; comparison, load and test cannot be used to the same register.
7 ; Compared value is used afterwards.
8 define i64 @f1(i64 %a, i64 %b, float %V, ptr %dst) {
10 ; CHECK: ltebr %f1, %f0
11 %cond = fcmp oeq float %V, 0.0
12 %res = select i1 %cond, i64 %a, i64 %b
13 store volatile float %V, ptr %dst
17 define i64 @f1m(i64 %a, i64 %b, float %V, ptr %dst) {
19 ; CHECK: ltebr %f1, %f0
20 %cond = fcmp oeq float %V, -0.0
21 %res = select i1 %cond, i64 %a, i64 %b
22 store volatile float %V, ptr %dst
26 ; Value only used in comparison.
27 define i64 @f2(i64 %a, i64 %b, float %V) {
29 ; CHECK: ltebr %f0, %f0
30 %cond = fcmp oeq float %V, 0.0
31 %res = select i1 %cond, i64 %a, i64 %b
35 define i64 @f2m(i64 %a, i64 %b, float %V) {
37 ; CHECK: ltebr %f0, %f0
38 %cond = fcmp oeq float %V, -0.0
39 %res = select i1 %cond, i64 %a, i64 %b
44 define i64 @f3(i64 %a, i64 %b, double %V, ptr %dst) {
46 ; CHECK: ltdbr %f1, %f0
47 %cond = fcmp oeq double %V, 0.0
48 %res = select i1 %cond, i64 %a, i64 %b
49 store volatile double %V, ptr %dst
53 define i64 @f3m(i64 %a, i64 %b, double %V, ptr %dst) {
55 ; CHECK: ltdbr %f1, %f0
56 %cond = fcmp oeq double %V, -0.0
57 %res = select i1 %cond, i64 %a, i64 %b
58 store volatile double %V, ptr %dst
62 define i64 @f4(i64 %a, i64 %b, double %V) {
64 ; CHECK: ltdbr %f0, %f0
65 %cond = fcmp oeq double %V, 0.0
66 %res = select i1 %cond, i64 %a, i64 %b
70 define i64 @f4m(i64 %a, i64 %b, double %V) {
72 ; CHECK: ltdbr %f0, %f0
73 %cond = fcmp oeq double %V, -0.0
74 %res = select i1 %cond, i64 %a, i64 %b
79 define i64 @f5(i64 %a, i64 %b, fp128 %V, ptr %dst) {
81 ; CHECK: ltxbr %f1, %f0
82 %cond = fcmp oeq fp128 %V, 0xL00000000000000008000000000000000
83 %res = select i1 %cond, i64 %a, i64 %b
84 store volatile fp128 %V, ptr %dst
88 define i64 @f6(i64 %a, i64 %b, fp128 %V) {
90 ; CHECK: ltxbr %f0, %f0
91 %cond = fcmp oeq fp128 %V, 0xL00000000000000008000000000000000
92 %res = select i1 %cond, i64 %a, i64 %b