Home | History | Annotate | Download | only in PowerPC
      1 ; FIXME: FastISel currently returns false if it hits code that uses VSX
      2 ; registers and with -fast-isel-abort=1 turned on the test case will then fail.
      3 ; When fastisel better supports VSX fix up this test case.
      4 ;
      5 ; RUN: llc < %s -O0 -verify-machineinstrs -mattr=-vsx -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64
      6 
      7 define i32 @t1(i8 signext %a) nounwind {
      8   %1 = sext i8 %a to i32
      9   ret i32 %1
     10 }
     11 
     12 define i32 @t2(i8 zeroext %a) nounwind {
     13   %1 = zext i8 %a to i32
     14   ret i32 %1
     15 }
     16 
     17 define i32 @t3(i16 signext %a) nounwind {
     18   %1 = sext i16 %a to i32
     19   ret i32 %1
     20 }
     21 
     22 define i32 @t4(i16 zeroext %a) nounwind {
     23   %1 = zext i16 %a to i32
     24   ret i32 %1
     25 }
     26 
     27 define void @foo(i8 %a, i16 %b) nounwind {
     28 ; ELF64: foo
     29   %1 = call i32 @t1(i8 signext %a)
     30 ; ELF64: extsb
     31   %2 = call i32 @t2(i8 zeroext %a)
     32 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56
     33   %3 = call i32 @t3(i16 signext %b)
     34 ; ELF64: extsh
     35   %4 = call i32 @t4(i16 zeroext %b)
     36 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48
     37 
     38 ;; A few test to check materialization
     39   %5 = call i32 @t2(i8 zeroext 255)
     40 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56
     41   %6 = call i32 @t4(i16 zeroext 65535)
     42 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48
     43   ret void
     44 }
     45 
     46 define void @foo2() nounwind {
     47   %1 = call signext i16 @t5()
     48   %2 = call zeroext i16 @t6()
     49   %3 = call signext i8 @t7()
     50   %4 = call zeroext i8 @t8()
     51   ret void
     52 }
     53 
     54 declare signext i16 @t5();
     55 declare zeroext i16 @t6();
     56 declare signext i8 @t7();
     57 declare zeroext i8 @t8();
     58 
     59 define i32 @t10(i32 %argc, i8** nocapture %argv) nounwind {
     60 entry:
     61 ; ELF64: t10
     62   %call = call i32 @bar(i8 zeroext 0, i8 zeroext -8, i8 zeroext -69, i8 zeroext 28, i8 zeroext 40, i8 zeroext -70)
     63 ; ELF64: li 3, 0
     64 ; ELF64: li 4, -8
     65 ; ELF64: li 5, -69
     66 ; ELF64: li 6, 28
     67 ; ELF64: li 7, 40
     68 ; ELF64: li 8, -70
     69 ; ELF64: rldicl 3, 3, 0, 56
     70 ; ELF64: rldicl 4, 4, 0, 56
     71 ; ELF64: rldicl 5, 5, 0, 56
     72 ; ELF64: rldicl 6, 6, 0, 56
     73 ; ELF64: rldicl 7, 7, 0, 56
     74 ; ELF64: rldicl 8, 8, 0, 56
     75   ret i32 0
     76 }
     77 
     78 declare i32 @bar(i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext)
     79 
     80 define i32 @bar0(i32 %i) nounwind {
     81   ret i32 0
     82 }
     83 
     84 ; Function pointers are not yet implemented.
     85 ;define void @foo3() uwtable {
     86 ;  %fptr = alloca i32 (i32)*, align 8
     87 ;  store i32 (i32)* @bar0, i32 (i32)** %fptr, align 8
     88 ;  %1 = load i32 (i32)*, i32 (i32)** %fptr, align 8
     89 ;  %call = call i32 %1(i32 0)
     90 ;  ret void
     91 ;}
     92 
     93 ; Intrinsic calls not yet implemented, and udiv isn't one for PPC anyway.
     94 ;define i32 @LibCall(i32 %a, i32 %b) {
     95 ;entry:
     96 ;        %tmp1 = udiv i32 %a, %b         ; <i32> [#uses=1]
     97 ;        ret i32 %tmp1
     98 ;}
     99 
    100 declare void @float_foo(float %f)
    101 
    102 define void @float_const() nounwind {
    103 entry:
    104 ; ELF64: float_const
    105   call void @float_foo(float 0x401C666660000000)
    106 ; ELF64: addis [[REG:[0-9]+]], 2, .LCPI[[SUF:[0-9_]+]]@toc@ha
    107 ; ELF64: lfs 1, .LCPI[[SUF]]@toc@l([[REG]])
    108   ret void
    109 }
    110 
    111 define void @float_reg(float %dummy, float %f) nounwind {
    112 entry:
    113 ; ELF64: float_reg
    114   call void @float_foo(float %f)
    115 ; ELF64: fmr 1, 2
    116   ret void
    117 }
    118 
    119 declare void @double_foo(double %d)
    120 
    121 define void @double_const() nounwind {
    122 entry:
    123 ; ELF64: double_const
    124   call void @double_foo(double 0x1397723CCABD0000401C666660000000)
    125 ; ELF64: addis [[REG2:[0-9]+]], 2, .LCPI[[SUF2:[0-9_]+]]@toc@ha
    126 ; ELF64: lfd 1, .LCPI[[SUF2]]@toc@l([[REG2]])
    127   ret void
    128 }
    129 
    130 define void @double_reg(double %dummy, double %d) nounwind {
    131 entry:
    132 ; ELF64: double_reg
    133   call void @double_foo(double %d)
    134 ; ELF64: fmr 1, 2
    135   ret void
    136 }
    137