1; RUN: llc -O0 -fast-isel-abort=1 -verify-machineinstrs -mtriple=arm64-apple-darwin < %s | FileCheck %s 2 3define zeroext i1 @fcmp_float1(float %a) { 4; CHECK-LABEL: fcmp_float1 5; CHECK: fcmp s0, #0.0 6; CHECK-NEXT: cset {{w[0-9]+}}, ne 7 %1 = fcmp une float %a, 0.000000e+00 8 ret i1 %1 9} 10 11define zeroext i1 @fcmp_float2(float %a, float %b) { 12; CHECK-LABEL: fcmp_float2 13; CHECK: fcmp s0, s1 14; CHECK-NEXT: cset {{w[0-9]+}}, ne 15 %1 = fcmp une float %a, %b 16 ret i1 %1 17} 18 19define zeroext i1 @fcmp_double1(double %a) { 20; CHECK-LABEL: fcmp_double1 21; CHECK: fcmp d0, #0.0 22; CHECK-NEXT: cset {{w[0-9]+}}, ne 23 %1 = fcmp une double %a, 0.000000e+00 24 ret i1 %1 25} 26 27define zeroext i1 @fcmp_double2(double %a, double %b) { 28; CHECK-LABEL: fcmp_double2 29; CHECK: fcmp d0, d1 30; CHECK-NEXT: cset {{w[0-9]+}}, ne 31 %1 = fcmp une double %a, %b 32 ret i1 %1 33} 34 35; Check each fcmp condition 36define zeroext i1 @fcmp_false(float %a) { 37; CHECK-LABEL: fcmp_false 38; CHECK: mov {{w[0-9]+}}, wzr 39 %1 = fcmp ogt float %a, %a 40 ret i1 %1 41} 42 43define zeroext i1 @fcmp_oeq(float %a, float %b) { 44; CHECK-LABEL: fcmp_oeq 45; CHECK: fcmp s0, s1 46; CHECK-NEXT: cset {{w[0-9]+}}, eq 47 %1 = fcmp oeq float %a, %b 48 ret i1 %1 49} 50 51define zeroext i1 @fcmp_ogt(float %a, float %b) { 52; CHECK-LABEL: fcmp_ogt 53; CHECK: fcmp s0, s1 54; CHECK-NEXT: cset {{w[0-9]+}}, gt 55 %1 = fcmp ogt float %a, %b 56 ret i1 %1 57} 58 59define zeroext i1 @fcmp_oge(float %a, float %b) { 60; CHECK-LABEL: fcmp_oge 61; CHECK: fcmp s0, s1 62; CHECK-NEXT: cset {{w[0-9]+}}, ge 63 %1 = fcmp oge float %a, %b 64 ret i1 %1 65} 66 67define zeroext i1 @fcmp_olt(float %a, float %b) { 68; CHECK-LABEL: fcmp_olt 69; CHECK: fcmp s0, s1 70; CHECK-NEXT: cset {{w[0-9]+}}, mi 71 %1 = fcmp olt float %a, %b 72 ret i1 %1 73} 74 75define zeroext i1 @fcmp_ole(float %a, float %b) { 76; CHECK-LABEL: fcmp_ole 77; CHECK: fcmp s0, s1 78; CHECK-NEXT: cset {{w[0-9]+}}, ls 79 %1 = fcmp ole float %a, %b 80 ret i1 %1 81} 82 83define zeroext i1 @fcmp_one(float %a, float %b) { 84; CHECK-LABEL: fcmp_one 85; CHECK: fcmp s0, s1 86; CHECK-NEXT: cset [[REG:w[0-9]+]], mi 87; CHECK-NEXT: csinc {{w[0-9]+}}, [[REG]], wzr, le 88 %1 = fcmp one float %a, %b 89 ret i1 %1 90} 91 92define zeroext i1 @fcmp_ord(float %a, float %b) { 93; CHECK-LABEL: fcmp_ord 94; CHECK: fcmp s0, s1 95; CHECK-NEXT: cset {{w[0-9]+}}, vc 96 %1 = fcmp ord float %a, %b 97 ret i1 %1 98} 99 100define zeroext i1 @fcmp_uno(float %a, float %b) { 101; CHECK-LABEL: fcmp_uno 102; CHECK: fcmp s0, s1 103; CHECK-NEXT: cset {{w[0-9]+}}, vs 104 %1 = fcmp uno float %a, %b 105 ret i1 %1 106} 107 108define zeroext i1 @fcmp_ueq(float %a, float %b) { 109; CHECK-LABEL: fcmp_ueq 110; CHECK: fcmp s0, s1 111; CHECK-NEXT: cset [[REG:w[0-9]+]], eq 112; CHECK-NEXT: csinc {{w[0-9]+}}, [[REG]], wzr, vc 113 %1 = fcmp ueq float %a, %b 114 ret i1 %1 115} 116 117define zeroext i1 @fcmp_ugt(float %a, float %b) { 118; CHECK-LABEL: fcmp_ugt 119; CHECK: fcmp s0, s1 120; CHECK-NEXT: cset {{w[0-9]+}}, hi 121 %1 = fcmp ugt float %a, %b 122 ret i1 %1 123} 124 125define zeroext i1 @fcmp_uge(float %a, float %b) { 126; CHECK-LABEL: fcmp_uge 127; CHECK: fcmp s0, s1 128; CHECK-NEXT: cset {{w[0-9]+}}, pl 129 %1 = fcmp uge float %a, %b 130 ret i1 %1 131} 132 133define zeroext i1 @fcmp_ult(float %a, float %b) { 134; CHECK-LABEL: fcmp_ult 135; CHECK: fcmp s0, s1 136; CHECK-NEXT: cset {{w[0-9]+}}, lt 137 %1 = fcmp ult float %a, %b 138 ret i1 %1 139} 140 141define zeroext i1 @fcmp_ule(float %a, float %b) { 142; CHECK-LABEL: fcmp_ule 143; CHECK: fcmp s0, s1 144; CHECK-NEXT: cset {{w[0-9]+}}, le 145 %1 = fcmp ule float %a, %b 146 ret i1 %1 147} 148 149define zeroext i1 @fcmp_une(float %a, float %b) { 150; CHECK-LABEL: fcmp_une 151; CHECK: fcmp s0, s1 152; CHECK-NEXT: cset {{w[0-9]+}}, ne 153 %1 = fcmp une float %a, %b 154 ret i1 %1 155} 156 157define zeroext i1 @fcmp_true(float %a) { 158; CHECK-LABEL: fcmp_true 159; CHECK: orr {{w[0-9]+}}, wzr, #0x1 160 %1 = fcmp ueq float %a, %a 161 ret i1 %1 162} 163