1 ; Check that 0.0 is not materialized for CSEL when comparing against it.
3 ; RUN: llc -mtriple=aarch64-linux-gnu -o - < %s | FileCheck %s
5 define float @foeq(float %a, float %b) #0 {
6 %t = fcmp oeq float %a, 0.0
7 %v = select i1 %t, float 0.0, float %b
10 ; CHECK: fcmp [[R:s[0-9]+]], #0.0
11 ; CHECK-NEXT: fcsel {{s[0-9]+}}, [[R]], {{s[0-9]+}}, eq
14 define float @fueq(float %a, float %b) #0 {
15 %t = fcmp ueq float %a, 0.0
16 %v = select i1 %t, float 0.0, float %b
19 ; CHECK: fcmp [[R:s[0-9]+]], #0.0
20 ; CHECK-NEXT: fcsel {{s[0-9]+}}, [[R]], {{s[0-9]+}}, eq
21 ; CHECK-NEXT: fcsel {{s[0-9]+}}, [[R]], {{s[0-9]+}}, vs
24 define float @fone(float %a, float %b) #0 {
25 %t = fcmp one float %a, 0.0
26 %v = select i1 %t, float %b, float 0.0
29 ; CHECK: fcmp [[R:s[0-9]+]], #0.0
30 ; CHECK-NEXT: fcsel {{s[0-9]+}}, {{s[0-9]+}}, [[R]], mi
31 ; CHECK-NEXT: fcsel {{s[0-9]+}}, {{s[0-9]+}}, [[R]], gt
34 define float @fune(float %a, float %b) #0 {
35 %t = fcmp une float %a, 0.0
36 %v = select i1 %t, float %b, float 0.0
39 ; CHECK: fcmp [[R:s[0-9]+]], #0.0
40 ; CHECK-NEXT: fcsel {{s[0-9]+}}, {{s[0-9]+}}, [[R]], ne
43 define double @doeq(double %a, double %b) #0 {
44 %t = fcmp oeq double %a, 0.0
45 %v = select i1 %t, double 0.0, double %b
48 ; CHECK: fcmp [[R:d[0-9]+]], #0.0
49 ; CHECK-NEXT: fcsel {{d[0-9]+}}, [[R]], {{d[0-9]+}}, eq
52 define double @dueq(double %a, double %b) #0 {
53 %t = fcmp ueq double %a, 0.0
54 %v = select i1 %t, double 0.0, double %b
57 ; CHECK: fcmp [[R:d[0-9]+]], #0.0
58 ; CHECK-NEXT: fcsel {{d[0-9]+}}, [[R]], {{d[0-9]+}}, eq
59 ; CHECK-NEXT: fcsel {{d[0-9]+}}, [[R]], {{d[0-9]+}}, vs
62 define double @done(double %a, double %b) #0 {
63 %t = fcmp one double %a, 0.0
64 %v = select i1 %t, double %b, double 0.0
67 ; CHECK: fcmp [[R:d[0-9]+]], #0.0
68 ; CHECK-NEXT: fcsel {{d[0-9]+}}, {{d[0-9]+}}, [[R]], mi
69 ; CHECK-NEXT: fcsel {{d[0-9]+}}, {{d[0-9]+}}, [[R]], gt
72 define double @dune(double %a, double %b) #0 {
73 %t = fcmp une double %a, 0.0
74 %v = select i1 %t, double %b, double 0.0
77 ; CHECK: fcmp [[R:d[0-9]+]], #0.0
78 ; CHECK-NEXT: fcsel {{d[0-9]+}}, {{d[0-9]+}}, [[R]], ne
81 attributes #0 = { nounwind "unsafe-fp-math"="true" }