Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s
      2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s
      3 
      4 define i64 @testOptimizeLiAddToAddi(i64 %a) {
      5 ; CHECK-LABEL: testOptimizeLiAddToAddi:
      6 ; CHECK:    addi 3, 3, 2444
      7 ; CHECK:    bl callv
      8 ; CHECK:    addi 3, 30, 234
      9 ; CHECK:    bl call
     10 ; CHECK:    blr
     11 entry:
     12   %cmp = icmp sgt i64 %a, 33
     13   br i1 %cmp, label %if.then, label %if.end
     14 
     15 if.then:
     16   tail call void bitcast (void (...)* @callv to void ()*)()
     17   br label %if.end
     18 
     19 if.end:
     20   %add.0 = phi i64 [ 234, %if.then ], [ 2444, %entry ]
     21   %add2 = add nsw i64 %add.0, %a
     22   %call = tail call i64 @call(i64 %add2)
     23   ret i64 %call
     24 }
     25 
     26 define i64 @testThreePhiIncomings(i64 %a) {
     27 ; CHECK-LABEL: testThreePhiIncomings:
     28 ; CHECK:    bl callv
     29 ; CHECK:    addi 3, 30, 234
     30 ; CHECK:    addi 3, 30, 2444
     31 ; CHECK:    bl callv
     32 ; CHECK:    addi 3, 30, 345
     33 ; CHECK:    bl call
     34 ; CHECK:    blr
     35 entry:
     36   %cmp = icmp slt i64 %a, 33
     37   br i1 %cmp, label %if.then, label %if.else
     38 
     39 if.then:
     40   tail call void bitcast (void (...)* @callv to void ()*)()
     41   br label %if.end4
     42 
     43 if.else:
     44   %cmp1 = icmp slt i64 %a, 55
     45   br i1 %cmp1, label %if.then2, label %if.end4
     46 
     47 if.then2:
     48   tail call void bitcast (void (...)* @callv to void ()*)()
     49   br label %if.end4
     50 
     51 if.end4:
     52   %add.0 = phi i64 [ 234, %if.then ], [ 345, %if.then2 ], [ 2444, %if.else ]
     53   %add5 = add nsw i64 %add.0, %a
     54   %call = tail call i64 @call(i64 %add5)
     55   ret i64 %call
     56 }
     57 
     58 declare void @callv(...)
     59 
     60 declare i64 @call(i64)
     61