brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.9 KiB · 7fd5811 Raw
221 lines · plain
1; RUN: llc -relocation-model=static < %s -O0 -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=-vsx -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF642; RUN: llc -relocation-model=static < %s -O0 -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=+vsx -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=VSX3; RUN: llc -relocation-model=static < %s -O0 -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=spe  -mtriple=powerpc-unknown-linux-gnu -mcpu=e500 | FileCheck %s --check-prefix=SPE4 5; This test verifies that load/store instructions are properly generated,6; and that they pass MI verification.7 8@a = dso_local global i8 1, align 19@b = dso_local global i16 2, align 210@c = dso_local global i32 4, align 411@d = dso_local global i64 8, align 812@e = dso_local global float 1.25, align 413@f = dso_local global double 3.5, align 814 15%struct.s = type<{ i8, i32 }>16%struct.t = type<{ i8, i64 }>17 18@g = dso_local global %struct.s <{ i8 1, i32 2 }>, align 119@h = dso_local global %struct.t <{ i8 1, i64 2 }>, align 120 21@i = common dso_local global [8192 x i64] zeroinitializer, align 822 23; load24 25define i8 @t1() nounwind {26; ELF64-LABEL: t1:27  %1 = load i8, ptr @a, align 128; ELF64: lbz29  %2 = add nsw i8 %1, 130; ELF64: addi31  ret i8 %232}33 34define i16 @t2() nounwind {35; ELF64-LABEL: t2:36  %1 = load i16, ptr @b, align 237; ELF64: lhz38  %2 = add nsw i16 %1, 139; ELF64: addi40  ret i16 %241}42 43define dso_local i32 @t3() nounwind {44; ELF64-LABEL: t3:45  %1 = load i32, ptr @c, align 446; ELF64: lwz47  %2 = add nsw i32 %1, 148; ELF64: addi49  ret i32 %250}51 52define i64 @t4() nounwind {53; ELF64-LABEL: t4:54  %1 = load i64, ptr @d, align 455; ELF64: ld56  %2 = add nsw i64 %1, 157; ELF64: addi58  ret i64 %259}60 61define dso_local float @t5() nounwind {62; ELF64-LABEL: t5:63; SPE-LABEL: t5:64  %1 = load float, ptr @e, align 465; ELF64: lfs66; SPE: lwz67  %2 = fadd float %1, 1.068; ELF64: fadds69; SPE: efsadd70  ret float %271}72 73define dso_local double @t6() nounwind {74; ELF64-LABEL: t6:75; SPE-LABEL: t6:76  %1 = load double, ptr @f, align 877; ELF64: lfd78; VSX: lxsdx79; SPE: evldd80  %2 = fadd double %1, 1.081; ELF64: fadd82; VSX: xsadddp83; SPE: efdadd84  ret double %285}86 87; store88 89define dso_local void @t7(i8 %v) nounwind {90; ELF64-LABEL: t7:91  %1 = add nsw i8 %v, 192  store i8 %1, ptr @a, align 193; ELF64: addi94; ELF64: addis95; ELF64: addi96; ELF64: stb97  ret void98}99 100define dso_local void @t8(i16 %v) nounwind {101; ELF64-LABEL: t8:102  %1 = add nsw i16 %v, 1103  store i16 %1, ptr @b, align 2104; ELF64: addi105; ELF64: addis106; ELF64: addi107; ELF64: sth108  ret void109}110 111define dso_local void @t9(i32 %v) nounwind {112; ELF64-LABEL: t9:113  %1 = add nsw i32 %v, 1114  store i32 %1, ptr @c, align 4115; ELF64: addi116; ELF64: addis117; ELF64: addi118; ELF64: stw119  ret void120}121 122define dso_local void @t10(i64 %v) nounwind {123; ELF64-LABEL: t10:124  %1 = add nsw i64 %v, 1125  store i64 %1, ptr @d, align 4126; ELF64: addi127; ELF64: addis128; ELF64: addi129; ELF64: std130  ret void131}132 133define dso_local void @t11(float %v) nounwind {134; ELF64-LABEL: t11:135; SPE-LABEL: t11:136  %1 = fadd float %v, 1.0137  store float %1, ptr @e, align 4138; ELF64: fadds139; ELF64: stfs140; SPE: efsadd141; SPE: stw142  ret void143}144 145define dso_local void @t12(double %v) nounwind {146; ELF64-LABEL: t12:147; SPE-LABEL: t12:148  %1 = fadd double %v, 1.0149  store double %1, ptr @f, align 8150; ELF64: fadd151; ELF64: stfd152; VSX: xsadddp153; VSX: stxsdx154; SPE: efdadd155; SPE: evstdd156  ret void157}158 159;; lwa requires an offset divisible by 4, so we need lwax here.160define i64 @t13() nounwind {161; ELF64-LABEL: t13:162  %1 = load i32, ptr getelementptr inbounds (%struct.s, ptr @g, i32 0, i32 1), align 1163  %2 = sext i32 %1 to i64164; ELF64: li165; ELF64: lwax166  %3 = add nsw i64 %2, 1167; ELF64: addi168  ret i64 %3169}170 171;; ld requires an offset divisible by 4, so we need ldx here.172define i64 @t14() nounwind {173; ELF64-LABEL: t14:174  %1 = load i64, ptr getelementptr inbounds (%struct.t, ptr @h, i32 0, i32 1), align 1175; ELF64: li176; ELF64: ldx177  %2 = add nsw i64 %1, 1178; ELF64: addi179  ret i64 %2180}181 182;; std requires an offset divisible by 4, so we need stdx here.183define dso_local void @t15(i64 %v) nounwind {184; ELF64-LABEL: t15:185  %1 = add nsw i64 %v, 1186  store i64 %1, ptr getelementptr inbounds (%struct.t, ptr @h, i32 0, i32 1), align 1187; ELF64: addi188; ELF64: addis189; ELF64: addi190; ELF64: li191; ELF64: stdx192  ret void193}194 195;; ld requires an offset that fits in 16 bits, so we need ldx here.196define i64 @t16() nounwind {197; ELF64-LABEL: t16:198  %1 = load i64, ptr getelementptr inbounds ([8192 x i64], ptr @i, i32 0, i64 5000), align 8199; ELF64: lis200; ELF64: ori201; ELF64: ldx202  %2 = add nsw i64 %1, 1203; ELF64: addi204  ret i64 %2205}206 207;; std requires an offset that fits in 16 bits, so we need stdx here.208define dso_local void @t17(i64 %v) nounwind {209; ELF64-LABEL: t17:210  %1 = add nsw i64 %v, 1211  store i64 %1, ptr getelementptr inbounds ([8192 x i64], ptr @i, i32 0, i64 5000), align 8212; ELF64: addi213; ELF64: addis214; ELF64: addi215; ELF64: lis216; ELF64: ori217; ELF64: stdx218  ret void219}220 221