87 lines · plain
1; Tests lowering of sfclass/dfclass compares.2; Sub-optimal code3; {4; p0 = sfclass(r0,#16)5; r0 = sfadd(r0,r0)6; }7; {8; r2 = p09; }10; {11; if (p0.new) r0 = ##106535321612; p0 = cmp.eq(r2,#0)13; jumpr r3114; }15; With the patterns added, we should be generating16; {17; p0 = sfclass(r0,#16)18; r0 = sfadd(r0,r0)19; }20; {21; if (!p0) r0 = ##106535321622; jumpr r3123; }24 25; RUN: llc -march=hexagon -stop-after=hexagon-isel %s -o - | FileCheck %s26 27; CHECK: bb.0.entry128; CHECK: F2_sfclass29; CHECK-NOT: C2_cmp30; CHECK: C2_not31; CHECK: F2_sfadd32; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)33define float @test1(float noundef %x) {34entry1:35 %0 = tail call i32 @llvm.hexagon.F2.sfclass(float %x, i32 16)36 %tobool.not = icmp eq i32 %0, 037 %add = fadd float %x, %x38 %spec.select = select i1 %tobool.not, float 1.000000e+00, float %add39 ret float %spec.select40}41 42; CHECK: bb.0.entry243; CHECK: F2_sfclass44; CHECK-NOT: C2_cmp45; CHECK: F2_sfadd46define float @test2(float noundef %x) {47entry2:48 %0 = tail call i32 @llvm.hexagon.F2.sfclass(float %x, i32 16)49 %tobool.not = icmp eq i32 %0, 050 %add = fadd float %x, %x51 %spec.select = select i1 %tobool.not, float %add, float 1.000000e+0052 ret float %spec.select53}54 55; CHECK: bb.0.entry356; CHECK: F2_dfclass57; CHECK-NOT: C2_cmp58; CHECK: C2_not59; CHECK: F2_dfadd60define double @test3(double noundef %x) {61entry3:62 %0 = tail call i32 @llvm.hexagon.F2.dfclass(double %x, i32 16)63 %tobool.not = icmp eq i32 %0, 064 %add = fadd double %x, %x65 %spec.select = select i1 %tobool.not, double 1.000000e+00, double %add66 ret double %spec.select67}68 69; CHECK: bb.0.entry470; CHECK: F2_dfclass71; CHECK-NOT: C2_cmp72; CHECK: F2_dfadd73define double @test4(double noundef %x) {74entry4:75 %0 = tail call i32 @llvm.hexagon.F2.dfclass(double %x, i32 16)76 %tobool.not = icmp eq i32 %0, 077 %add = fadd double %x, %x78 %spec.select = select i1 %tobool.not, double %add, double 1.000000e+0079 ret double %spec.select80}81 82; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none)83declare i32 @llvm.hexagon.F2.dfclass(double, i32 immarg)84 85; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none)86declare i32 @llvm.hexagon.F2.sfclass(float, i32 immarg)87