| 1 |
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \ |
| 2 |
; RUN: -mtriple powerpc-ibm-aix-xcoff -stop-after=machine-cp < %s | \ |
| 3 |
; RUN: FileCheck --check-prefixes=CHECKMIR,MIR32 %s |
| 4 |
|
| 5 |
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \ |
| 6 |
; RUN: -mtriple powerpc-ibm-aix-xcoff < %s | \ |
| 7 |
; RUN: FileCheck --check-prefixes=CHECKASM,ASMOBJ32,ASM32 %s |
| 8 |
|
| 9 |
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \ |
| 10 |
; RUN: -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp < %s | \ |
| 11 |
; RUN: FileCheck --check-prefixes=CHECKMIR,MIR64 %s |
| 12 |
|
| 13 |
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \ |
| 14 |
; RUN: -mtriple powerpc64-ibm-aix-xcoff < %s | \ |
| 15 |
; RUN: FileCheck --check-prefixes=CHECKASM,ASM64 %s |
| 16 |
|
| 17 |
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \ |
| 18 |
; RUN: -mtriple powerpc-ibm-aix-xcoff -filetype=obj < %s -o %t |
| 19 |
; RUN: llvm-objdump -d %t | FileCheck \ |
| 20 |
; RUN: --check-prefixes=CHECKOBJ,ASMOBJ32,OBJ32 %s |
| 21 |
|
| 22 |
define signext i32 @callThroughPtr(ptr nocapture) { |
| 23 |
%2 = tail call signext i32 %0() |
| 24 |
ret i32 %2 |
| 25 |
} |
| 26 |
|
| 27 |
; CHECKMIR: name: callThroughPtr |
| 28 |
|
| 29 |
; MIR32: liveins: $r3 |
| 30 |
; MIR32: ADJCALLSTACKDOWN 56, 0, implicit-def dead $r1, implicit $r1 |
| 31 |
; MIR32-DAG: STW $r2, 20, $r1 |
| 32 |
; MIR32-DAG: renamable $r11 = LWZ 8, renamable $r3 :: (dereferenceable invariant load (s32) from %ir.0 + 8) |
| 33 |
; MIR32-DAG: renamable $[[REG:r[0-9]+]] = LWZ 0, renamable $r3 :: (dereferenceable invariant load (s32) from %ir.0) |
| 34 |
; MIR32-DAG: $r2 = LWZ 4, killed renamable $r3 :: (dereferenceable invariant load (s32) from %ir.0 + 4) |
| 35 |
; MIR32-DAG: MTCTR killed renamable $[[REG]], implicit-def $ctr |
| 36 |
; MIR32-NEXT: BCTRL_LWZinto_toc 20, $r1, csr_aix32, implicit-def dead $lr, implicit-def dead $r2, implicit $ctr, implicit $rm, implicit $r11, implicit $r2, implicit-def $r1, implicit-def $r3 |
| 37 |
; MIR32-NEXT: ADJCALLSTACKUP 56, 0, implicit-def dead $r1, implicit $r1 |
| 38 |
|
| 39 |
; MIR64: liveins: $x3 |
| 40 |
; MIR64: ADJCALLSTACKDOWN 112, 0, implicit-def dead $r1, implicit $r1 |
| 41 |
; MIR64-DAG: STD $x2, 40, $x1 :: (store (s64) into stack + 40) |
| 42 |
; MIR64-DAG: renamable $x11 = LD 16, renamable $x3 :: (dereferenceable invariant load (s64) from %ir.0 + 16) |
| 43 |
; MIR64-DAG: renamable $[[REG:x[0-9]+]] = LD 0, renamable $x3 :: (dereferenceable invariant load (s64) from %ir.0) |
| 44 |
; MIR64-DAG: $x2 = LD 8, killed renamable $x3 :: (dereferenceable invariant load (s64) from %ir.0 + 8) |
| 45 |
; MIR64-DAG: MTCTR8 killed renamable $[[REG]], implicit-def $ctr8 |
| 46 |
; MIR64-NEXT: BCTRL8_LDinto_toc 40, $x1, csr_ppc64, implicit-def dead $lr8, implicit-def dead $x2, implicit $ctr8, implicit $rm, implicit $x11, implicit $x2, implicit-def $r1, implicit-def $x3 |
| 47 |
; MIR64-NEXT: ADJCALLSTACKUP 112, 0, implicit-def dead $r1, implicit $r1 |
| 48 |
|
| 49 |
; CHECKASM-LABEL: .callThroughPtr: |
| 50 |
|
| 51 |
; ASM32: stwu 1, -64(1) |
| 52 |
; ASM32-DAG: lwz [[REG:[0-9]+]], 0(3) |
| 53 |
; ASM32-DAG: stw 2, 20(1) |
| 54 |
; ASM32-DAG: mtctr [[REG]] |
| 55 |
; ASM32-DAG: lwz 11, 8(3) |
| 56 |
; ASM32-DAG: lwz 2, 4(3) |
| 57 |
; ASM32-NEXT: bctrl |
| 58 |
; ASM32-NEXT: lwz 2, 20(1) |
| 59 |
; ASM32-NEXT: addi 1, 1, 64 |
| 60 |
|
| 61 |
; ASM64: stdu 1, -112(1) |
| 62 |
; ASM64-DAG: ld [[REG:[0-9]+]], 0(3) |
| 63 |
; ASM64-DAG: std 2, 40(1) |
| 64 |
; ASM64-DAG: mtctr [[REG]] |
| 65 |
; ASM64-DAG: ld 11, 16(3) |
| 66 |
; ASM64-DAG: ld 2, 8(3) |
| 67 |
; ASM64-NEXT: bctrl |
| 68 |
; ASM64-NEXT: ld 2, 40(1) |
| 69 |
; ASM64-NEXT: addi 1, 1, 112 |
| 70 |
|
| 71 |
; OBJ32-LABEL: .text: |
| 72 |
; OBJ32: stwu 1, -64(1) |
| 73 |
; OBJ32-DAG: lwz [[REG:[0-9]+]], 0(3) |
| 74 |
; OBJ32-DAG: stw 2, 20(1) |
| 75 |
; OBJ32-DAG: mtctr [[REG]] |
| 76 |
; OBJ32-DAG: lwz 11, 8(3) |
| 77 |
; OBJ32-DAG: lwz 2, 4(3) |
| 78 |
; OBJ32-NEXT: 4e 80 04 21 bctrl |
| 79 |
; OBJ32-NEXT: 80 41 00 14 lwz 2, 20(1) |
| 80 |
; OBJ32-NEXT: addi 1, 1, 64 |
| 81 |
|
| 82 |
define void @callThroughPtrWithArgs(ptr nocapture) { |
| 83 |
tail call void %0(i32 signext 1, i16 zeroext 2, i64 3) |
| 84 |
ret void |
| 85 |
} |
| 86 |
|
| 87 |
; CHECKMIR: name: callThroughPtrWithArgs |
| 88 |
|
| 89 |
; MIR32: liveins: $r3 |
| 90 |
; MIR32: ADJCALLSTACKDOWN 56, 0, implicit-def dead $r1, implicit $r1 |
| 91 |
; MIR32-DAG: renamable $[[REG:r[0-9]+]] = LWZ 0, renamable $r3 :: (dereferenceable invariant load (s32) from %ir.0) |
| 92 |
; MIR32-DAG: MTCTR killed renamable $[[REG]], implicit-def $ctr |
| 93 |
; MIR32-DAG: STW $r2, 20, $r1 :: (store (s32) into stack + 20) |
| 94 |
; MIR32-DAG: renamable $r11 = LWZ 8, renamable $r3 :: (dereferenceable invariant load (s32) from %ir.0 + 8) |
| 95 |
; MIR32-DAG: $r2 = LWZ 4, killed renamable $r3 :: (dereferenceable invariant load (s32) from %ir.0 + 4) |
| 96 |
; MIR32-DAG: $r3 = LI 1 |
| 97 |
; MIR32-DAG: $r4 = LI 2 |
| 98 |
; MIR32-DAG: $r5 = LI 0 |
| 99 |
; MIR32-DAG: $r6 = LI 3 |
| 100 |
; MIR32-NEXT: BCTRL_LWZinto_toc 20, $r1, csr_aix32, implicit-def dead $lr, implicit-def dead $r2, implicit $ctr, implicit $rm, implicit $r11, implicit $r3, implicit $r4, implicit $r5, implicit $r6, implicit $r2, implicit-def $r1 |
| 101 |
; MIR32-NEXT: ADJCALLSTACKUP 56, 0, implicit-def dead $r1, implicit $r1 |
| 102 |
|
| 103 |
; MIR64: liveins: $x3 |
| 104 |
; MIR64: ADJCALLSTACKDOWN 112, 0, implicit-def dead $r1, implicit $r1 |
| 105 |
; MIR64-DAG: renamable $[[REG:x[0-9]+]] = LD 0, renamable $x3 :: (dereferenceable invariant load (s64) from %ir.0) |
| 106 |
; MIR64-DAG: MTCTR8 killed renamable $[[REG]], implicit-def $ctr8 |
| 107 |
; MIR64-DAG: STD $x2, 40, $x1 :: (store (s64) into stack + 40) |
| 108 |
; MIR64-DAG: renamable $x11 = LD 16, renamable $x3 :: (dereferenceable invariant load (s64) from %ir.0 + 16) |
| 109 |
; MIR64-DAG: $x2 = LD 8, killed renamable $x3 :: (dereferenceable invariant load (s64) from %ir.0 + 8) |
| 110 |
; MIR64-DAG: $x3 = LI8 1 |
| 111 |
; MIR64-DAG: $x4 = LI8 2 |
| 112 |
; MIR64-DAG: $x5 = LI8 3 |
| 113 |
; MIR64-NEXT: BCTRL8_LDinto_toc 40, $x1, csr_ppc64, implicit-def dead $lr8, implicit-def dead $x2, implicit $ctr8, implicit $rm, implicit $x11, implicit $x3, implicit $x4, implicit $x5, implicit $x2, implicit-def $r1 |
| 114 |
; MIR64-NEXT: ADJCALLSTACKUP 112, 0, implicit-def dead $r1, implicit $r1 |
| 115 |
|
| 116 |
; CHECKASM-LABEL: .callThroughPtrWithArgs: |
| 117 |
; CHECKOBJ-LABEL: <.callThroughPtrWithArgs>: |
| 118 |
|
| 119 |
; ASMOBJ32: stwu 1, -64(1) |
| 120 |
; ASMOBJ32-DAG: lwz [[REG:[0-9]+]], 0(3) |
| 121 |
; ASMOBJ32-DAG: li 5, 0 |
| 122 |
; ASMOBJ32-DAG: li 6, 3 |
| 123 |
; ASMOBJ32-DAG: stw 2, 20(1) |
| 124 |
; ASMOBJ32-DAG: mtctr [[REG]] |
| 125 |
; ASMOBJ32-DAG: li 4, 2 |
| 126 |
; ASMOBJ32-DAG: lwz 11, 8(3) |
| 127 |
; ASMOBJ32-DAG: lwz 2, 4(3) |
| 128 |
; ASMOBJ32-DAG: li 3, 1 |
| 129 |
; ASMOBJ32-NEXT: bctrl |
| 130 |
; ASMOBJ32-NEXT: lwz 2, 20(1) |
| 131 |
; ASMOBJ32-NEXT: addi 1, 1, 64 |
| 132 |
|
| 133 |
; ASM64: stdu 1, -112(1) |
| 134 |
; ASM64-DAG: ld [[REG:[0-9]+]], 0(3) |
| 135 |
; ASM64-DAG: li 5, 3 |
| 136 |
; ASM64-DAG: std 2, 40(1) |
| 137 |
; ASM64-DAG: mtctr [[REG]] |
| 138 |
; ASM64-DAG: li 4, 2 |
| 139 |
; ASM64-DAG: ld 11, 16(3) |
| 140 |
; ASM64-DAG: ld 2, 8(3) |
| 141 |
; ASM64-DAG: li 3, 1 |
| 142 |
; ASM64-NEXT: bctrl |
| 143 |
; ASM64-NEXT: ld 2, 40(1) |
| 144 |
; ASM64-NEXT: addi 1, 1, 112 |