Home | History | Annotate | Download | only in llvm2ice_tests
      1 ; Test on -enable-sc if basic blocks are split when short circuit evaluation
      2 ; is possible for boolean expressions
      3 
      4 ; REQUIRES: allow_dump
      5 
      6 ; RUN: %p2i -i %s --filetype=asm --target x8632 --args \
      7 ; RUN: -O2 -enable-sc | FileCheck %s --check-prefix=ENABLE \
      8 ; RUN: --check-prefix=CHECK
      9 
     10 ; RUN: %p2i -i %s --filetype=asm --target x8632 --args \
     11 ; RUN: -O2 | FileCheck %s --check-prefix=NOENABLE \
     12 ; RUN: --check-prefix=CHECK
     13 
     14 define internal i32 @short_circuit(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4,
     15                                    i32 %arg5) {
     16   %t0 = trunc i32 %arg1 to i1
     17   %t1 = trunc i32 %arg2 to i1
     18   %t2 = trunc i32 %arg3 to i1
     19   %t3 = trunc i32 %arg4 to i1
     20   %t4 = trunc i32 %arg5 to i1
     21 
     22   %t5 = or i1 %t0, %t1
     23   %t6 = and i1 %t5, %t2
     24   %t7 = and i1 %t3, %t4
     25   %t8 = or i1 %t6, %t7
     26 
     27   br i1 %t8, label %target_true, label %target_false
     28 
     29 target_true:
     30   ret i32 1
     31 
     32 target_false:
     33   ret i32 0
     34 }
     35 
     36 ; CHECK-LABEL: short_circuit
     37 ; NOENABLE: .Lshort_circuit$__0:
     38 ; ENABLE: .Lshort_circuit$__0_1_1:
     39 ; ENABLE: .Lshort_circuit$__0_1_2:
     40 ; ENABLE: .Lshort_circuit$__0_2:
     41 ; CHECK: .Lshort_circuit$target_true:
     42 ; CHECK: .Lshort_circuit$target_false:
     43