154 lines · plain
1; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp -mcpu=pwr4 \2; RUN: -mattr=-altivec -verify-machineinstrs < %s | \3; RUN: FileCheck %s4 5; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \6; RUN: -mtriple powerpc64-ibm-aix-xcoff < %s | \7; RUN: FileCheck --check-prefix=ASM %s8 9%struct.S5 = type { [5 x i8] }10 11define zeroext i8 @test_byval_5Byte(ptr byval(%struct.S5) align 1 %s) {12entry:13 %arrayidx = getelementptr inbounds %struct.S5, ptr %s, i32 0, i32 0, i32 414 %0 = load i8, ptr %arrayidx, align 115 ret i8 %016}17 18; CHECK-LABEL: name: test_byval_5Byte19 20; CHECK: fixedStack:21; CHECK-NEXT: - { id: 0, type: default, offset: 48, size: 8, alignment: 16,22; CHECK: bb.0.entry:23; CHECK-NEXT: liveins: $x324; CHECK: STD killed renamable $x3, 0, %fixed-stack.0 :: (store (s64) into %fixed-stack.0, align 16)25; CHECK-NEXT: renamable $x3 = LBZ8 4, %fixed-stack.0 :: (dereferenceable load (s8)26 27; ASM-LABEL: .test_byval_5Byte:28 29; ASM: std 3, 48(1)30; ASM-NEXT: lbz 3, 52(1)31; ASM-NEXT: blr32 33 34%struct.S6 = type { [6 x i8] }35 36define zeroext i8 @test_byval_6Byte(ptr byval(%struct.S6) align 1 %s) {37entry:38 %arrayidx = getelementptr inbounds %struct.S6, ptr %s, i32 0, i32 0, i32 539 %0 = load i8, ptr %arrayidx, align 140 ret i8 %041}42 43; CHECK-LABEL: name: test_byval_6Byte44 45; CHECK: fixedStack:46; CHECK-NEXT: - { id: 0, type: default, offset: 48, size: 8, alignment: 16,47; CHECK: bb.0.entry:48; CHECK-NEXT: liveins: $x349; CHECK: STD killed renamable $x3, 0, %fixed-stack.0 :: (store (s64) into %fixed-stack.0, align 16)50; CHECK-NEXT: renamable $x3 = LBZ8 5, %fixed-stack.0 :: (dereferenceable load (s8)51 52; ASM-LABEL: .test_byval_6Byte:53 54; ASM: std 3, 48(1)55; ASM-NEXT: lbz 3, 53(1)56; ASM-NEXT: blr57 58 59%struct.S7 = type { [7 x i8] }60 61define zeroext i8 @test_byval_7Byte(ptr byval(%struct.S7) align 1 %s) {62entry:63 %arrayidx = getelementptr inbounds %struct.S7, ptr %s, i32 0, i32 0, i32 664 %0 = load i8, ptr %arrayidx, align 165 ret i8 %066}67 68; CHECK-LABEL: name: test_byval_7Byte69 70; CHECK: fixedStack:71; CHECK-NEXT: - { id: 0, type: default, offset: 48, size: 8, alignment: 16,72; CHECK: bb.0.entry:73; CHECK-NEXT: liveins: $x374; CHECK: STD killed renamable $x3, 0, %fixed-stack.0 :: (store (s64) into %fixed-stack.0, align 16)75; CHECK-NEXT: renamable $x3 = LBZ8 6, %fixed-stack.0 :: (dereferenceable load (s8)76 77; ASM-LABEL: .test_byval_7Byte:78 79; ASM: std 3, 48(1)80; ASM-NEXT: lbz 3, 54(1)81; ASM-NEXT: blr82 83 84%struct.S8 = type { [8 x i8] }85 86define zeroext i8 @test_byval_8Byte(ptr byval(%struct.S8) align 1 %s) {87entry:88 %arrayidx = getelementptr inbounds %struct.S8, ptr %s, i32 0, i32 0, i32 789 %0 = load i8, ptr %arrayidx, align 190 ret i8 %091}92 93; CHECK-LABEL: name: test_byval_8Byte94 95; CHECK: fixedStack:96; CHECK-NEXT: - { id: 0, type: default, offset: 48, size: 8, alignment: 16,97; CHECK: bb.0.entry:98; CHECK-NEXT: liveins: $x399; CHECK: renamable $x[[SCRATCH:[0-9]+]] = COPY $x3100; CHECK-DAG: renamable $x3 = RLDICL $x3, 0, 56101; CHECK-DAG: STD killed renamable $x[[SCRATCH]], 0, %fixed-stack.0 :: (store (s64) into %fixed-stack.0, align 16)102 103 104; ASM-LABEL: .test_byval_8Byte:105 106; ASM: mr [[SCRATCH:[0-9]+]], 3107; ASM-DAG: clrldi 3, 3, 56108; ASM-DAG: std [[SCRATCH]], 48(1)109; ASM-NEXT: blr110 111 112%struct.S64 = type { [64 x i8] }113 114@gS64 = external global %struct.S64, align 1115 116define void @call_test_byval_64Byte() {117entry:118 call void @test_byval_64Byte(ptr byval(%struct.S64) align 1 @gS64)119 ret void120}121 122declare void @test_byval_64Byte(ptr byval(%struct.S64) align 1)123 124; CHECK-LABEL: name: call_test_byval_64Byte{{.*}}125 126; The DAG block permits some invalid inputs for the benefit of allowing more valid orderings.127; CHECK: ADJCALLSTACKDOWN 112, 0, implicit-def dead $r1, implicit $r1128; CHECK-NEXT: renamable $x[[REGADDR:[0-9]+]] = LDtoc @gS64, $x2 :: (load (s64) from got)129; CHECK-DAG: renamable $x3 = LD 0, killed renamable $x[[REGADDR]] :: (load (s64))130; CHECK-DAG: renamable $x4 = LD 8, renamable $x[[REGADDR]] :: (load (s64))131; CHECK-DAG: renamable $x5 = LD 16, renamable $x[[REGADDR]] :: (load (s64))132; CHECK-DAG: renamable $x6 = LD 24, renamable $x[[REGADDR]] :: (load (s64))133; CHECK-DAG: renamable $x7 = LD 32, renamable $x[[REGADDR]] :: (load (s64))134; CHECK-DAG: renamable $x8 = LD 40, renamable $x[[REGADDR]] :: (load (s64))135; CHECK-DAG: renamable $x9 = LD 48, renamable $x[[REGADDR]] :: (load (s64))136; CHECK-DAG: renamable $x10 = LD 56, renamable $x[[REGADDR]] :: (load (s64))137; CHECK-NEXT: BL8_NOP <mcsymbol .test_byval_64Byte[PR]>, csr_ppc64, implicit-def dead $lr8, implicit $rm, implicit $x3, implicit $x4, implicit $x5, implicit $x6, implicit $x7, implicit $x8, implicit $x9, implicit $x10, implicit $x2, implicit-def $r1138; CHECK-NEXT: ADJCALLSTACKUP 112, 0, implicit-def dead $r1, implicit $r1139 140; ASM-LABEL: .call_test_byval_64Byte:141 142; ASM: stdu 1, -112(1)143; ASM-NEXT: ld [[REG:[0-9]+]], L..C{{[0-9]+}}(2)144; ASM-DAG: ld 3, 0([[REG]])145; ASM-DAG: ld 4, 8([[REG]])146; ASM-DAG: ld 5, 16([[REG]])147; ASM-DAG: ld 6, 24([[REG]])148; ASM-DAG: ld 7, 32([[REG]])149; ASM-DAG: ld 8, 40([[REG]])150; ASM-DAG: ld 9, 48([[REG]])151; ASM-DAG: ld 10, 56([[REG]])152; ASM-NEXT: bl .test_byval_64Byte153; ASM-NEXT: nop154