1; RUN: llc < %s -O0 -relocation-model=pic -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -ppc-late-peephole=true | FileCheck %s --check-prefix=ELF64 2 3define i32 @t1(i8 signext %a) nounwind { 4 %1 = sext i8 %a to i32 5 ret i32 %1 6} 7 8define i32 @t2(i8 zeroext %a) nounwind { 9 %1 = zext i8 %a to i32 10 ret i32 %1 11} 12 13define i32 @t3(i16 signext %a) nounwind { 14 %1 = sext i16 %a to i32 15 ret i32 %1 16} 17 18define i32 @t4(i16 zeroext %a) nounwind { 19 %1 = zext i16 %a to i32 20 ret i32 %1 21} 22 23define void @foo(i8 %a, i16 %b) nounwind { 24; ELF64: foo 25 %1 = call i32 @t1(i8 signext %a) 26; ELF64: extsb 27 %2 = call i32 @t2(i8 zeroext %a) 28; ELF64: clrldi {{[0-9]+}}, {{[0-9]+}}, 56 29 %3 = call i32 @t3(i16 signext %b) 30; ELF64: extsh 31 %4 = call i32 @t4(i16 zeroext %b) 32; ELF64: clrldi {{[0-9]+}}, {{[0-9]+}}, 48 33 34;; A few test to check materialization 35 %5 = call i32 @t2(i8 zeroext 255) 36; ELF64: li 3, 255 37; ELF64-NOT: clrldi 38 %6 = call i32 @t4(i16 zeroext 65535) 39; ELF64: lis 3, 0 40; ELF64: ori 3, 3, 65535 41; ELF64: clrldi 3, 3, 48 42; ELF64: bl t4 43 ret void 44} 45 46define 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 54declare signext i16 @t5(); 55declare zeroext i16 @t6(); 56declare signext i8 @t7(); 57declare zeroext i8 @t8(); 58 59define i32 @t10(i32 %argc, i8** nocapture %argv) nounwind { 60entry: 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, 248 65; ELF64: li 5, 187 66; ELF64: li 6, 28 67; ELF64: li 7, 40 68; ELF64: li 8, 186 69; ELF64-NOT: clrldi 70; ELF64: bl bar 71 ret i32 0 72} 73 74declare i32 @bar(i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext) 75 76define i32 @bar0(i32 %i) nounwind { 77 ret i32 0 78} 79 80; Function pointers are not yet implemented. 81;define void @foo3() uwtable { 82; %fptr = alloca i32 (i32)*, align 8 83; store i32 (i32)* @bar0, i32 (i32)** %fptr, align 8 84; %1 = load i32 (i32)*, i32 (i32)** %fptr, align 8 85; %call = call i32 %1(i32 0) 86; ret void 87;} 88 89; Intrinsic calls not yet implemented, and udiv isn't one for PPC anyway. 90;define i32 @LibCall(i32 %a, i32 %b) { 91;entry: 92; %tmp1 = udiv i32 %a, %b ; <i32> [#uses=1] 93; ret i32 %tmp1 94;} 95 96declare void @float_foo(float %f) 97 98define void @float_const() nounwind { 99entry: 100; ELF64: float_const 101 call void @float_foo(float 0x401C666660000000) 102; ELF64: addis [[REG:[0-9]+]], 2, .LCPI[[SUF:[0-9_]+]]@toc@ha 103; ELF64: lfs 1, .LCPI[[SUF]]@toc@l([[REG]]) 104 ret void 105} 106 107define void @float_reg(float %dummy, float %f) nounwind { 108entry: 109; ELF64: float_reg 110 call void @float_foo(float %f) 111; ELF64: fmr 1, 2 112 ret void 113} 114 115declare void @double_foo(double %d) 116 117define void @double_const() nounwind { 118entry: 119; ELF64: double_const 120 call void @double_foo(double 0x1397723CCABD0000401C666660000000) 121; ELF64: addis [[REG2:[0-9]+]], 2, .LCPI[[SUF2:[0-9_]+]]@toc@ha 122; ELF64: lfd 1, .LCPI[[SUF2]]@toc@l([[REG2]]) 123 ret void 124} 125 126define void @double_reg(double %dummy, double %d) nounwind { 127entry: 128; ELF64: double_reg 129 call void @double_foo(double %d) 130; ELF64: fmr 1, 2 131 ret void 132} 133