Home | History | Annotate | Download | only in llvm2ice_tests
      1 ; Simple test of non-fused compare/branch.
      2 
      3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \
      4 ; RUN:   -allow-externally-defined-symbols | FileCheck %s
      5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \
      6 ; RUN:   -allow-externally-defined-symbols | FileCheck --check-prefix=OPTM1 %s
      7 
      8 define internal void @testBool(i32 %a, i32 %b) {
      9 entry:
     10   %cmp = icmp slt i32 %a, %b
     11   %cmp1 = icmp sgt i32 %a, %b
     12   br i1 %cmp, label %if.then, label %if.end
     13 
     14 if.then:                                          ; preds = %entry
     15   %cmp_ext = zext i1 %cmp to i32
     16   tail call void @use(i32 %cmp_ext)
     17   br label %if.end
     18 
     19 if.end:                                           ; preds = %if.then, %entry
     20   br i1 %cmp1, label %if.then5, label %if.end7
     21 
     22 if.then5:                                         ; preds = %if.end
     23   %cmp1_ext = zext i1 %cmp1 to i32
     24   tail call void @use(i32 %cmp1_ext)
     25   br label %if.end7
     26 
     27 if.end7:                                          ; preds = %if.then5, %if.end
     28   ret void
     29 }
     30 
     31 declare void @use(i32)
     32 
     33 ; CHECK-LABEL: testBool
     34 ; Two bool computations
     35 ; CHECK:      cmp
     36 ; CHECK:      cmp
     37 ; Test first bool
     38 ; CHECK:      cmp
     39 ; CHECK:      call
     40 ; Test second bool
     41 ; CHECK:      cmp
     42 ; CHECK:      call
     43 ; CHECK:      ret
     44 ;
     45 ; OPTM1-LABEL: testBool
     46 ; Two bool computations
     47 ; OPTM1:      cmp
     48 ; OPTM1:      cmp
     49 ; Test first bool
     50 ; OPTM1:      cmp
     51 ; OPTM1:      call
     52 ; Test second bool
     53 ; OPTM1:      cmp
     54 ; OPTM1:      call
     55 ; OPTM1:      ret
     56