191 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2 3; RUN: opt -S -passes=argpromotion -mtriple=aarch64-unknwon-linux-gnu < %s | FileCheck %s4 5target triple = "aarch64-unknown-linux-gnu"6 7; Don't promote a vector pointer argument when the pointee type size is greater8; than 128 bits.9 10define dso_local void @caller_8xi32(ptr noalias %src, ptr noalias %dst) #0 {11; CHECK-LABEL: define dso_local void @caller_8xi32(12; CHECK-NEXT: entry:13; CHECK-NEXT: call fastcc void @callee_8xi32(ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]])14; CHECK-NEXT: ret void15;16entry:17 call fastcc void @callee_8xi32(ptr noalias %src, ptr noalias %dst)18 ret void19}20 21define internal fastcc void @callee_8xi32(ptr noalias %src, ptr noalias %dst) #0 {22; CHECK-LABEL: define internal fastcc void @callee_8xi32(23; CHECK-NEXT: entry:24; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i32>, ptr [[SRC:%.*]], align 1625; CHECK-NEXT: store <8 x i32> [[TMP0]], ptr [[DST:%.*]], align 1626; CHECK-NEXT: ret void27;28entry:29 %0 = load <8 x i32>, ptr %src, align 1630 store <8 x i32> %0, ptr %dst, align 1631 ret void32}33 34; Promote a vector pointer argument when the pointee type size is 128 bits or35; less.36 37define dso_local void @caller_4xi32(ptr noalias %src, ptr noalias %dst) #1 {38; CHECK-LABEL: define dso_local void @caller_4xi32(39; CHECK-NEXT: entry:40; CHECK-NEXT: [[SRC_VAL:%.*]] = load <4 x i32>, ptr [[SRC:%.*]], align 1641; CHECK-NEXT: call fastcc void @callee_4xi32(<4 x i32> [[SRC_VAL]], ptr noalias [[DST:%.*]])42; CHECK-NEXT: ret void43;44entry:45 call fastcc void @callee_4xi32(ptr noalias %src, ptr noalias %dst)46 ret void47}48 49define internal fastcc void @callee_4xi32(ptr noalias %src, ptr noalias %dst) #1 {50; CHECK-LABEL: define internal fastcc void @callee_4xi32(51; CHECK-NEXT: entry:52; CHECK-NEXT: store <4 x i32> [[SRC_0_VAL:%.*]], ptr [[DST:%.*]], align 1653; CHECK-NEXT: ret void54;55entry:56 %0 = load <4 x i32>, ptr %src, align 1657 store <4 x i32> %0, ptr %dst, align 1658 ret void59}60 61; A scalar pointer argument is promoted even when the pointee type size is62; greater than 128 bits.63 64define dso_local void @caller_i256(ptr noalias %src, ptr noalias %dst) #0 {65; CHECK-LABEL: define dso_local void @caller_i256(66; CHECK-NEXT: entry:67; CHECK-NEXT: [[SRC_VAL:%.*]] = load i256, ptr [[SRC:%.*]], align 1668; CHECK-NEXT: call fastcc void @callee_i256(i256 [[SRC_VAL]], ptr noalias [[DST:%.*]])69; CHECK-NEXT: ret void70;71entry:72 call fastcc void @callee_i256(ptr noalias %src, ptr noalias %dst)73 ret void74}75 76define internal fastcc void @callee_i256(ptr noalias %src, ptr noalias %dst) #0 {77; CHECK-LABEL: define internal fastcc void @callee_i256(78; CHECK-NEXT: entry:79; CHECK-NEXT: store i256 [[SRC_0_VAL:%.*]], ptr [[DST:%.*]], align 1680; CHECK-NEXT: ret void81;82entry:83 %0 = load i256, ptr %src, align 1684 store i256 %0, ptr %dst, align 1685 ret void86}87 88; A scalable vector pointer argument is not a target of ArgumentPromotionPass.89 90define dso_local void @caller_nx4xi32(ptr noalias %src, ptr noalias %dst) #2 {91; CHECK-LABEL: define dso_local void @caller_nx4xi32(92; CHECK-NEXT: entry:93; CHECK-NEXT: call fastcc void @callee_nx4xi32(ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]])94; CHECK-NEXT: ret void95;96entry:97 call fastcc void @callee_nx4xi32(ptr noalias %src, ptr noalias %dst)98 ret void99}100 101define internal fastcc void @callee_nx4xi32(ptr noalias %src, ptr noalias %dst) #2 {102; CHECK-LABEL: define internal fastcc void @callee_nx4xi32(103; CHECK-NEXT: entry:104; CHECK-NEXT: [[TMP0:%.*]] = load <vscale x 4 x i32>, ptr [[SRC:%.*]], align 16105; CHECK-NEXT: store <vscale x 4 x i32> [[TMP0]], ptr [[DST:%.*]], align 16106; CHECK-NEXT: ret void107;108entry:109 %0 = load <vscale x 4 x i32>, ptr %src, align 16110 store <vscale x 4 x i32> %0, ptr %dst, align 16111 ret void112}113 114; Don't promote a structure pointer argument when the pointee vector member115; type size is greater than 128 bits.116 117%struct_8xi32 = type { <8 x i32>, <8 x i32> }118 119define dso_local void @caller_struct8xi32(ptr noalias %src, ptr noalias %dst) #0 {120; CHECK-LABEL: define dso_local void @caller_struct8xi32(121; CHECK-NEXT: entry:122; CHECK-NEXT: call fastcc void @callee_struct8xi32(ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]])123; CHECK-NEXT: ret void124;125entry:126 call fastcc void @callee_struct8xi32(ptr noalias %src, ptr noalias %dst)127 ret void128}129 130define internal fastcc void @callee_struct8xi32(ptr noalias %src, ptr noalias %dst) #0 {131; CHECK-LABEL: define internal fastcc void @callee_struct8xi32(132; CHECK-NEXT: entry:133; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i32>, ptr [[SRC:%.*]], align 16134; CHECK-NEXT: store <8 x i32> [[TMP0]], ptr [[DST:%.*]], align 16135; CHECK-NEXT: [[SRC2:%.*]] = getelementptr inbounds [[STRUCT_8XI32:%.*]], ptr [[SRC]], i64 0, i32 1136; CHECK-NEXT: [[TMP1:%.*]] = load <8 x i32>, ptr [[SRC2]], align 16137; CHECK-NEXT: [[DST2:%.*]] = getelementptr inbounds [[STRUCT_8XI32]], ptr [[DST]], i64 0, i32 1138; CHECK-NEXT: store <8 x i32> [[TMP1]], ptr [[DST2]], align 16139; CHECK-NEXT: ret void140;141entry:142 %0 = load <8 x i32>, ptr %src, align 16143 store <8 x i32> %0, ptr %dst, align 16144 %src2 = getelementptr inbounds %struct_8xi32, ptr %src, i64 0, i32 1145 %1 = load <8 x i32>, ptr %src2, align 16146 %dst2 = getelementptr inbounds %struct_8xi32, ptr %dst, i64 0, i32 1147 store <8 x i32> %1, ptr %dst2, align 16148 ret void149}150 151; Promote a structure pointer argument when the pointee vector member type size152; is 128 bits or less.153 154%struct_4xi32 = type { <4 x i32>, <4 x i32> }155 156define dso_local void @caller_struct4xi32(ptr noalias %src, ptr noalias %dst) #1 {157; CHECK-LABEL: define dso_local void @caller_struct4xi32(158; CHECK-NEXT: entry:159; CHECK-NEXT: [[SRC_VAL:%.*]] = load <4 x i32>, ptr [[SRC:%.*]], align 16160; CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr [[SRC]], i64 16161; CHECK-NEXT: [[SRC_VAL1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 16162; CHECK-NEXT: call fastcc void @callee_struct4xi32(<4 x i32> [[SRC_VAL]], <4 x i32> [[SRC_VAL1]], ptr noalias [[DST:%.*]])163; CHECK-NEXT: ret void164;165entry:166 call fastcc void @callee_struct4xi32(ptr noalias %src, ptr noalias %dst)167 ret void168}169 170define internal fastcc void @callee_struct4xi32(ptr noalias %src, ptr noalias %dst) #1 {171; CHECK-LABEL: define internal fastcc void @callee_struct4xi32(172; CHECK-NEXT: entry:173; CHECK-NEXT: store <4 x i32> [[SRC_0_VAL:%.*]], ptr [[DST:%.*]], align 16174; CHECK-NEXT: [[DST2:%.*]] = getelementptr inbounds [[STRUCT_4XI32:%.*]], ptr [[DST]], i64 0, i32 1175; CHECK-NEXT: store <4 x i32> [[SRC_16_VAL:%.*]], ptr [[DST2]], align 16176; CHECK-NEXT: ret void177;178entry:179 %0 = load <4 x i32>, ptr %src, align 16180 store <4 x i32> %0, ptr %dst, align 16181 %src2 = getelementptr inbounds %struct_4xi32, ptr %src, i64 0, i32 1182 %1 = load <4 x i32>, ptr %src2, align 16183 %dst2 = getelementptr inbounds %struct_4xi32, ptr %dst, i64 0, i32 1184 store <4 x i32> %1, ptr %dst2, align 16185 ret void186}187 188attributes #0 = { noinline vscale_range(2,2) "target-features"="+v8.2a,+neon,+sve" }189attributes #1 = { noinline vscale_range(1,1) "target-features"="+v8.2a,+neon,+sve" }190attributes #2 = { noinline "target-features"="+v8.2a,+neon,+sve" }191