brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.3 KiB · 6091e2b Raw
249 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-linux-gnu -o - | FileCheck %s3 4; This test checks that only a single jae gets generated in the final code5; for lowering the CMOV pseudos that get created for this IR.  The tricky part6; of this test is that it tests the special PHI operand rewriting code in7; X86TargetLowering::EmitLoweredSelect.8;9define double @foo1(float %p1, double %p2, double %p3) nounwind {10entry:11  %c1 = fcmp oge float %p1, 0.000000e+0012  %d0 = fadd double %p2, 1.25e013  %d1 = fadd double %p3, 1.25e014  %d2 = select i1 %c1, double %d0, double %d115  %d3 = select i1 %c1, double %d2, double %p216  %d4 = select i1 %c1, double %d3, double %p317  %d5 = fsub double %d2, %d318  %d6 = fadd double %d5, %d419  ret double %d620}21 22; This test checks that only a single jae gets generated in the final code23; for lowering the CMOV pseudos that get created for this IR.  The tricky part24; of this test is that it tests the special PHI operand rewriting code in25; X86TargetLowering::EmitLoweredSelect.26;27define double @foo2(float %p1, double %p2, double %p3) nounwind {28; CHECK-LABEL: foo2:29; CHECK:       # %bb.0: # %entry30; CHECK-NEXT:    xorps %xmm3, %xmm331; CHECK-NEXT:    ucomiss %xmm3, %xmm032; CHECK-NEXT:    movsd {{.*#+}} xmm0 = [1.25E+0,0.0E+0]33; CHECK-NEXT:    jae .LBB1_134; CHECK-NEXT:  # %bb.2: # %entry35; CHECK-NEXT:    addsd %xmm0, %xmm236; CHECK-NEXT:    movapd %xmm2, %xmm037; CHECK-NEXT:    movapd %xmm2, %xmm138; CHECK-NEXT:    jmp .LBB1_339; CHECK-NEXT:  .LBB1_1:40; CHECK-NEXT:    addsd %xmm1, %xmm041; CHECK-NEXT:  .LBB1_3: # %entry42; CHECK-NEXT:    subsd %xmm1, %xmm043; CHECK-NEXT:    addsd %xmm2, %xmm044; CHECK-NEXT:    retq45entry:46  %c1 = fcmp oge float %p1, 0.000000e+0047  %d0 = fadd double %p2, 1.25e048  %d1 = fadd double %p3, 1.25e049  %d2 = select i1 %c1, double %d0, double %d150  %d3 = select i1 %c1, double %p2, double %d251  %d4 = select i1 %c1, double %p3, double %d352  %d5 = fsub double %d2, %d353  %d6 = fadd double %d5, %d454  ret double %d655}56 57; This test checks that only a single js gets generated in the final code58; for lowering the CMOV pseudos that get created for this IR.  The tricky part59; of this test is that it tests the special PHI operand rewriting code in60; X86TargetLowering::EmitLoweredSelect.  It also tests to make sure all61; the operands of the resulting instructions are from the proper places.62;63define double @foo3(i32 %p1, double %p2, double %p3,64; CHECK-LABEL: foo3:65; CHECK:       # %bb.0: # %entry66; CHECK-NEXT:    testl %edi, %edi67; CHECK-NEXT:    js .LBB2_268; CHECK-NEXT:  # %bb.1: # %entry69; CHECK-NEXT:    movapd %xmm2, %xmm170; CHECK-NEXT:    movapd %xmm2, %xmm071; CHECK-NEXT:  .LBB2_2: # %entry72; CHECK-NEXT:    divsd %xmm1, %xmm073; CHECK-NEXT:    retq74                             double %p4, double %p5) nounwind {75entry:76  %c1 = icmp slt i32 %p1, 077  %d2 = select i1 %c1, double %p2, double %p378  %d3 = select i1 %c1, double %p3, double %p479  %d4 = select i1 %c1, double %d2, double %d380  %d5 = fdiv double %d4, %d381  ret double %d582}83 84; This test checks that only a single js gets generated in the final code85; for lowering the CMOV pseudos that get created for this IR.  The tricky part86; of this test is that it tests the special PHI operand rewriting code in87; X86TargetLowering::EmitLoweredSelect.  It also tests to make sure all88; the operands of the resulting instructions are from the proper places89; when the "opposite condition" handling code in the compiler is used.90; This should be the same code as foo3 above, because we use the opposite91; condition code in the second two selects, but we also swap the operands92; of the selects to give the same actual computation.93;94define double @foo4(i32 %p1, double %p2, double %p3,95; CHECK-LABEL: foo4:96; CHECK:       # %bb.0: # %entry97; CHECK-NEXT:    testl %edi, %edi98; CHECK-NEXT:    js .LBB3_299; CHECK-NEXT:  # %bb.1: # %entry100; CHECK-NEXT:    movapd %xmm2, %xmm1101; CHECK-NEXT:    movapd %xmm2, %xmm0102; CHECK-NEXT:  .LBB3_2: # %entry103; CHECK-NEXT:    divsd %xmm1, %xmm0104; CHECK-NEXT:    retq105                             double %p4, double %p5) nounwind {106entry:107  %c1 = icmp slt i32 %p1, 0108  %d2 = select i1 %c1, double %p2, double %p3109  %c2 = icmp sge i32 %p1, 0110  %d3 = select i1 %c2, double %p4, double %p3111  %d4 = select i1 %c2, double %d3, double %d2112  %d5 = fdiv double %d4, %d3113  ret double %d5114}115 116; This test checks that only a single jae gets generated in the final code117; for lowering the CMOV pseudos that get created for this IR.  The tricky part118; of this test is that it tests the special code in CodeGenPrepare.119;120define double @foo5(float %p1, double %p2, double %p3) nounwind {121; CHECK-LABEL: foo5:122; CHECK:       # %bb.0: # %entry123; CHECK-NEXT:    xorps %xmm3, %xmm3124; CHECK-NEXT:    ucomiss %xmm3, %xmm0125; CHECK-NEXT:    movsd {{.*#+}} xmm0 = [1.25E+0,0.0E+0]126; CHECK-NEXT:    jae .LBB4_1127; CHECK-NEXT:  # %bb.2: # %select.false128; CHECK-NEXT:    addsd %xmm2, %xmm0129; CHECK-NEXT:  .LBB4_3: # %select.end130; CHECK-NEXT:    subsd %xmm1, %xmm0131; CHECK-NEXT:    addsd %xmm2, %xmm0132; CHECK-NEXT:    retq133; CHECK-NEXT:  .LBB4_1:134; CHECK-NEXT:    addsd %xmm0, %xmm1135; CHECK-NEXT:    movapd %xmm1, %xmm0136; CHECK-NEXT:    movapd %xmm1, %xmm2137; CHECK-NEXT:    jmp .LBB4_3138entry:139  %c1 = fcmp oge float %p1, 0.000000e+00140  %d0 = fadd double %p2, 1.25e0141  %d1 = fadd double %p3, 1.25e0142  %d2 = select i1 %c1, double %d0, double %d1, !prof !0143  %d3 = select i1 %c1, double %d2, double %p2, !prof !0144  %d4 = select i1 %c1, double %d3, double %p3, !prof !0145  %d5 = fsub double %d2, %d3146  %d6 = fadd double %d5, %d4147  ret double %d6148}149 150; We should expand select instructions into 3 conditional branches as their151; condtions are different.152;153define double @foo6(float %p1, double %p2, double %p3) nounwind {154; CHECK-LABEL: foo6:155; CHECK:       # %bb.0: # %entry156; CHECK-NEXT:    movaps %xmm0, %xmm3157; CHECK-NEXT:    xorps %xmm0, %xmm0158; CHECK-NEXT:    ucomiss %xmm0, %xmm3159; CHECK-NEXT:    movsd {{.*#+}} xmm0 = [1.25E+0,0.0E+0]160; CHECK-NEXT:    jae .LBB5_1161; CHECK-NEXT:  # %bb.2: # %select.false162; CHECK-NEXT:    addsd %xmm2, %xmm0163; CHECK-NEXT:  .LBB5_3: # %select.end164; CHECK-NEXT:    ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3165; CHECK-NEXT:    movapd %xmm0, %xmm4166; CHECK-NEXT:    jae .LBB5_5167; CHECK-NEXT:  # %bb.4: # %select.false2168; CHECK-NEXT:    movapd %xmm1, %xmm4169; CHECK-NEXT:  .LBB5_5: # %select.end1170; CHECK-NEXT:    ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3171; CHECK-NEXT:    movapd %xmm4, %xmm1172; CHECK-NEXT:    jae .LBB5_7173; CHECK-NEXT:  # %bb.6: # %select.false4174; CHECK-NEXT:    movapd %xmm2, %xmm1175; CHECK-NEXT:  .LBB5_7: # %select.end3176; CHECK-NEXT:    subsd %xmm4, %xmm0177; CHECK-NEXT:    addsd %xmm1, %xmm0178; CHECK-NEXT:    retq179; CHECK-NEXT:  .LBB5_1:180; CHECK-NEXT:    addsd %xmm1, %xmm0181; CHECK-NEXT:    jmp .LBB5_3182entry:183  %c1 = fcmp oge float %p1, 0.000000e+00184  %c2 = fcmp oge float %p1, 1.000000e+00185  %c3 = fcmp oge float %p1, 2.000000e+00186  %d0 = fadd double %p2, 1.25e0187  %d1 = fadd double %p3, 1.25e0188  %d2 = select i1 %c1, double %d0, double %d1, !prof !0189  %d3 = select i1 %c2, double %d2, double %p2, !prof !0190  %d4 = select i1 %c3, double %d3, double %p3, !prof !0191  %d5 = fsub double %d2, %d3192  %d6 = fadd double %d5, %d4193  ret double %d6194}195 196declare void @llvm.dbg.value(metadata, metadata, metadata)197 198; Like the test for @foo1, but check that the inserted dbg.value does not199; affect codegen. The CHECK items below should always be identical to @foo1,200; minus the DEBUG_VALUE line and changes in labels..201define double @foo1_g(float %p1, double %p2, double %p3) nounwind !dbg !4 {202; CHECK-LABEL: foo1_g:203; CHECK:       # %bb.0: # %entry204; CHECK-NEXT:    .file   1 "." "test.c"205; CHECK-NEXT:    .loc 1 3 0 prologue_end206; CHECK-NEXT:    xorps %xmm3, %xmm3207; CHECK-NEXT:    ucomiss %xmm3, %xmm0208; CHECK-NEXT:    movsd {{.*#+}} xmm0 = [1.25E+0,0.0E+0]209; CHECK-NEXT:    jae .LBB6_1210; CHECK-NEXT:  # %bb.2: # %entry211; CHECK-NEXT:    addsd %xmm2, %xmm0212; CHECK-NEXT:    jmp .LBB6_3213; CHECK-NEXT:  .LBB6_1:214; CHECK-NEXT:    addsd %xmm0, %xmm1215; CHECK-NEXT:    movapd %xmm1, %xmm0216; CHECK-NEXT:    movapd %xmm1, %xmm2217; CHECK-NEXT:  .LBB6_3: # %entry218; CHECK-NEXT:    #DEBUG_VALUE: foobar:xyzzy <- undef219; CHECK-NEXT:    subsd %xmm1, %xmm0220; CHECK-NEXT:    addsd %xmm2, %xmm0221; CHECK-NEXT:    retq222entry:223  %c1 = fcmp oge float %p1, 0.000000e+00224  %d0 = fadd double %p2, 1.25e0225  %d1 = fadd double %p3, 1.25e0226  %d2 = select i1 %c1, double %d0, double %d1227  call void @llvm.dbg.value(metadata float undef, metadata !5, metadata !DIExpression()), !dbg !6228  %d3 = select i1 %c1, double %d2, double %p2229  %d4 = select i1 %c1, double %d3, double %p3230  %d5 = fsub double %d2, %d3231  %d6 = fadd double %d5, %d4232  ret double %d6233}234 235!llvm.module.flags = !{!1}236!llvm.dbg.cu = !{!2}237 238!0 = !{!"branch_weights", i32 1, i32 2000}239!1 = !{i32 2, !"Debug Info Version", i32 3}240!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, nameTableKind: None)241!3 = !DIFile(filename: "test.c", directory: ".")242!4 = distinct !DISubprogram(name: "foobar", scope: !2, file: !3, line: 1, type: !9, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !8)243!5 = !DILocalVariable(name: "xyzzy", scope: !4, file: !3, line: 2, type: !7)244!6 = !DILocation(line: 1, column: 1, scope: !4)245!7 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)246!8 = !{!5}247!9 = !DISubroutineType(types: !10)248!10 = !{!7}249