brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 6769add Raw
69 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -o - %s | FileCheck %s3target triple = "x86_64-unknown-unknown"4 5; select with and i1/or i1 condition should be implemented as a series of 26; cmovs, not by producing two conditions and using and on them.7 8define dso_local i32 @select_and(i32 %a0, i32 %a1, float %a2, float %a3, i32 %a4, i32 %a5) {9; CHECK-LABEL: select_and:10; CHECK:       # %bb.0:11; CHECK-NEXT:    movl %edx, %eax12; CHECK-NEXT:    ucomiss %xmm0, %xmm113; CHECK-NEXT:    cmovbel %ecx, %eax14; CHECK-NEXT:    cmpl %esi, %edi15; CHECK-NEXT:    cmovael %ecx, %eax16; CHECK-NEXT:    retq17  %cmp0 = icmp ult i32 %a0, %a118  %cmp1 = fcmp olt float %a2, %a319  %and = and i1 %cmp0, %cmp120  %res = select i1 %and, i32 %a4, i32 %a521  ret i32 %res22}23 24; select with and i1 condition should be implemented as a series of 2 cmovs, not25; by producing two conditions and using and on them.26 27define dso_local i32 @select_or(i32 %a0, i32 %a1, float %a2, float %a3, i32 %a4, i32 %a5) {28; CHECK-LABEL: select_or:29; CHECK:       # %bb.0:30; CHECK-NEXT:    movl %ecx, %eax31; CHECK-NEXT:    ucomiss %xmm0, %xmm132; CHECK-NEXT:    cmoval %edx, %eax33; CHECK-NEXT:    cmpl %esi, %edi34; CHECK-NEXT:    cmovbl %edx, %eax35; CHECK-NEXT:    retq36  %cmp0 = icmp ult i32 %a0, %a137  %cmp1 = fcmp olt float %a2, %a338  %and = or i1 %cmp0, %cmp139  %res = select i1 %and, i32 %a4, i32 %a540  ret i32 %res41}42 43; If one of the conditions is materialized as a 0/1 value anyway, then the44; sequence of 2 cmovs should not be used.45 46@var32 = dso_local global i32 047define dso_local i32 @select_noopt(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4) {48; CHECK-LABEL: select_noopt:49; CHECK:       # %bb.0:50; CHECK-NEXT:    movl %ecx, %eax51; CHECK-NEXT:    cmpl %esi, %edi52; CHECK-NEXT:    setb %cl53; CHECK-NEXT:    cmpl %edx, %esi54; CHECK-NEXT:    setb %dl55; CHECK-NEXT:    orb %cl, %dl56; CHECK-NEXT:    movzbl %dl, %ecx57; CHECK-NEXT:    movl %ecx, var32(%rip)58; CHECK-NEXT:    testb %cl, %cl59; CHECK-NEXT:    cmovel %r8d, %eax60; CHECK-NEXT:    retq61  %cmp0 = icmp ult i32 %a0, %a162  %cmp1 = icmp ult i32 %a1, %a263  %or = or i1 %cmp0, %cmp164  %zero_one = zext i1 %or to i3265  store volatile i32 %zero_one, ptr @var3266  %res = select i1 %or, i32 %a3, i32 %a467  ret i32 %res68}69