diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-15 22:30:16 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-15 22:30:16 +0000 |
| commit | 9f61947910e6ab40de38e6b4034751ef1513200f (patch) | |
| tree | 3231b7529d89052b2edb92bb5ddc6a9e960e5161 /test/CodeGen/PowerPC | |
| parent | 5ca98fd98791947eba83a1ed3f2c8191ef7afa6c (diff) | |
Notes
Diffstat (limited to 'test/CodeGen/PowerPC')
| -rw-r--r-- | test/CodeGen/PowerPC/blockaddress.ll | 26 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/cc.ll | 2 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/fast-isel-conversion.ll | 121 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/fast-isel-ret.ll | 66 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/ia-mem-r0.ll | 94 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/ia-neg-const.ll | 25 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/stack-realign.ll | 8 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/subreg-postra-2.ll | 175 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/subreg-postra.ll | 168 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/tls-pic.ll | 16 | ||||
| -rw-r--r-- | test/CodeGen/PowerPC/tls-store2.ll | 33 |
11 files changed, 715 insertions, 19 deletions
diff --git a/test/CodeGen/PowerPC/blockaddress.ll b/test/CodeGen/PowerPC/blockaddress.ll new file mode 100644 index 0000000000000..c1981e21fff44 --- /dev/null +++ b/test/CodeGen/PowerPC/blockaddress.ll @@ -0,0 +1,26 @@ +; RUN: llc < %s -code-model=small -march=ppc64 -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=SMALL +; RUN: llc < %s -code-model=medium -march=ppc64 -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM +; RUN: llc < %s -code-model=large -march=ppc64 -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM +; RUN: llc < %s -code-model=small -march=ppc64 -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=SMALL +; RUN: llc < %s -code-model=medium -march=ppc64 -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM +; RUN: llc < %s -code-model=large -march=ppc64 -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM + +define i8* @test() { +entry: + br label %here + +here: ; preds = %entry +; MEDIUM: .Ltmp[[TMP0:[0-9]+]]: +; MEDIUM: addis [[R0:[0-9]+]], 2, .LC[[LC0:[0-9]+]]@toc@ha +; MEDIUM: ld 3, .LC[[LC0]]@toc@l([[R0]]) +; MEDIUM: blr +; MEDIUM: .LC[[LC0]]: +; MEDIUM: .tc .Ltmp[[TMP0]][TC],.Ltmp[[TMP0]] +; SMALL: .Ltmp[[TMP0:[0-9]+]]: +; SMALL: ld 3, .LC[[LC0:[0-9]+]]@toc(2) +; SMALL: blr +; SMALL: .LC[[LC0]]: +; SMALL: .tc .Ltmp[[TMP0]][TC],.Ltmp[[TMP0]] + ret i8* blockaddress(@test, %here) +} + diff --git a/test/CodeGen/PowerPC/cc.ll b/test/CodeGen/PowerPC/cc.ll index f92121bd7202d..c23ee7c9f5c80 100644 --- a/test/CodeGen/PowerPC/cc.ll +++ b/test/CodeGen/PowerPC/cc.ll @@ -41,7 +41,7 @@ entry: br label %foo foo: - call { i64, i64 } asm sideeffect "sc", "={r0},={r3},{r0},~{cc}" (i64 %a) + call { i64, i64 } asm sideeffect "sc", "={r0},={r3},{r0},~{cc},~{cr1},~{cr2},~{cr3},~{cr4},~{cr5},~{cr6},~{cr7}" (i64 %a) br i1 %c, label %bar, label %end bar: diff --git a/test/CodeGen/PowerPC/fast-isel-conversion.ll b/test/CodeGen/PowerPC/fast-isel-conversion.ll index 5e00675c03981..71611060ed7a9 100644 --- a/test/CodeGen/PowerPC/fast-isel-conversion.ll +++ b/test/CodeGen/PowerPC/fast-isel-conversion.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64 +; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s --check-prefix=ELF64LE ; RUN: llc < %s -O0 -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=970 | FileCheck %s --check-prefix=PPC970 ;; Tests for 970 don't use -fast-isel-abort because we intentionally punt @@ -9,12 +10,16 @@ define void @sitofp_single_i64(i64 %a, float %b) nounwind ssp { entry: ; ELF64: sitofp_single_i64 +; ELF64LE: sitofp_single_i64 ; PPC970: sitofp_single_i64 %b.addr = alloca float, align 4 %conv = sitofp i64 %a to float ; ELF64: std ; ELF64: lfd ; ELF64: fcfids +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfids ; PPC970: std ; PPC970: lfd ; PPC970: fcfid @@ -26,12 +31,20 @@ entry: define void @sitofp_single_i32(i32 %a, float %b) nounwind ssp { entry: ; ELF64: sitofp_single_i32 +; ELF64LE: sitofp_single_i32 ; PPC970: sitofp_single_i32 %b.addr = alloca float, align 4 %conv = sitofp i32 %a to float ; ELF64: std +; stack offset used to load the float: 65524 = -16 + 4 +; ELF64: ori {{[0-9]+}}, {{[0-9]+}}, 65524 ; ELF64: lfiwax ; ELF64: fcfids +; ELF64LE: std +; stack offset used to load the float: 65520 = -16 + 0 +; ELF64LE: ori {{[0-9]+}}, {{[0-9]+}}, 65520 +; ELF64LE: lfiwax +; ELF64LE: fcfids ; PPC970: std ; PPC970: lfd ; PPC970: fcfid @@ -43,6 +56,7 @@ entry: define void @sitofp_single_i16(i16 %a, float %b) nounwind ssp { entry: ; ELF64: sitofp_single_i16 +; ELF64LE: sitofp_single_i16 ; PPC970: sitofp_single_i16 %b.addr = alloca float, align 4 %conv = sitofp i16 %a to float @@ -50,6 +64,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfids +; ELF64LE: extsh +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfids ; PPC970: extsh ; PPC970: std ; PPC970: lfd @@ -62,6 +80,7 @@ entry: define void @sitofp_single_i8(i8 %a) nounwind ssp { entry: ; ELF64: sitofp_single_i8 +; ELF64LE: sitofp_single_i8 ; PPC970: sitofp_single_i8 %b.addr = alloca float, align 4 %conv = sitofp i8 %a to float @@ -69,6 +88,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfids +; ELF64LE: extsb +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfids ; PPC970: extsb ; PPC970: std ; PPC970: lfd @@ -81,12 +104,20 @@ entry: define void @sitofp_double_i32(i32 %a, double %b) nounwind ssp { entry: ; ELF64: sitofp_double_i32 +; ELF64LE: sitofp_double_i32 ; PPC970: sitofp_double_i32 %b.addr = alloca double, align 8 %conv = sitofp i32 %a to double ; ELF64: std +; stack offset used to load the float: 65524 = -16 + 4 +; ELF64: ori {{[0-9]+}}, {{[0-9]+}}, 65524 ; ELF64: lfiwax ; ELF64: fcfid +; ELF64LE: std +; stack offset used to load the float: 65520 = -16 + 0 +; ELF64LE: ori {{[0-9]+}}, {{[0-9]+}}, 65520 +; ELF64LE: lfiwax +; ELF64LE: fcfid ; PPC970: std ; PPC970: lfd ; PPC970: fcfid @@ -97,12 +128,16 @@ entry: define void @sitofp_double_i64(i64 %a, double %b) nounwind ssp { entry: ; ELF64: sitofp_double_i64 +; ELF64LE: sitofp_double_i64 ; PPC970: sitofp_double_i64 %b.addr = alloca double, align 8 %conv = sitofp i64 %a to double ; ELF64: std ; ELF64: lfd ; ELF64: fcfid +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfid ; PPC970: std ; PPC970: lfd ; PPC970: fcfid @@ -113,6 +148,7 @@ entry: define void @sitofp_double_i16(i16 %a, double %b) nounwind ssp { entry: ; ELF64: sitofp_double_i16 +; ELF64LE: sitofp_double_i16 ; PPC970: sitofp_double_i16 %b.addr = alloca double, align 8 %conv = sitofp i16 %a to double @@ -120,6 +156,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfid +; ELF64LE: extsh +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfid ; PPC970: extsh ; PPC970: std ; PPC970: lfd @@ -131,6 +171,7 @@ entry: define void @sitofp_double_i8(i8 %a, double %b) nounwind ssp { entry: ; ELF64: sitofp_double_i8 +; ELF64LE: sitofp_double_i8 ; PPC970: sitofp_double_i8 %b.addr = alloca double, align 8 %conv = sitofp i8 %a to double @@ -138,6 +179,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfid +; ELF64LE: extsb +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfid ; PPC970: extsb ; PPC970: std ; PPC970: lfd @@ -151,12 +196,16 @@ entry: define void @uitofp_single_i64(i64 %a, float %b) nounwind ssp { entry: ; ELF64: uitofp_single_i64 +; ELF64LE: uitofp_single_i64 ; PPC970: uitofp_single_i64 %b.addr = alloca float, align 4 %conv = uitofp i64 %a to float ; ELF64: std ; ELF64: lfd ; ELF64: fcfidus +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfidus ; PPC970-NOT: fcfidus store float %conv, float* %b.addr, align 4 ret void @@ -165,12 +214,20 @@ entry: define void @uitofp_single_i32(i32 %a, float %b) nounwind ssp { entry: ; ELF64: uitofp_single_i32 +; ELF64LE: uitofp_single_i32 ; PPC970: uitofp_single_i32 %b.addr = alloca float, align 4 %conv = uitofp i32 %a to float ; ELF64: std +; stack offset used to load the float: 65524 = -16 + 4 +; ELF64: ori {{[0-9]+}}, {{[0-9]+}}, 65524 ; ELF64: lfiwzx ; ELF64: fcfidus +; ELF64LE: std +; stack offset used to load the float: 65520 = -16 + 0 +; ELF64LE: ori {{[0-9]+}}, {{[0-9]+}}, 65520 +; ELF64LE: lfiwzx +; ELF64LE: fcfidus ; PPC970-NOT: lfiwzx ; PPC970-NOT: fcfidus store float %conv, float* %b.addr, align 4 @@ -180,6 +237,7 @@ entry: define void @uitofp_single_i16(i16 %a, float %b) nounwind ssp { entry: ; ELF64: uitofp_single_i16 +; ELF64LE: uitofp_single_i16 ; PPC970: uitofp_single_i16 %b.addr = alloca float, align 4 %conv = uitofp i16 %a to float @@ -187,6 +245,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfidus +; ELF64LE: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48 +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfidus ; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 16, 31 ; PPC970: std ; PPC970: lfd @@ -199,6 +261,7 @@ entry: define void @uitofp_single_i8(i8 %a) nounwind ssp { entry: ; ELF64: uitofp_single_i8 +; ELF64LE: uitofp_single_i8 ; PPC970: uitofp_single_i8 %b.addr = alloca float, align 4 %conv = uitofp i8 %a to float @@ -206,6 +269,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfidus +; ELF64LE: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56 +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfidus ; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 24, 31 ; PPC970: std ; PPC970: lfd @@ -218,12 +285,16 @@ entry: define void @uitofp_double_i64(i64 %a, double %b) nounwind ssp { entry: ; ELF64: uitofp_double_i64 +; ELF64LE: uitofp_double_i64 ; PPC970: uitofp_double_i64 %b.addr = alloca double, align 8 %conv = uitofp i64 %a to double ; ELF64: std ; ELF64: lfd ; ELF64: fcfidu +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfidu ; PPC970-NOT: fcfidu store double %conv, double* %b.addr, align 8 ret void @@ -232,12 +303,20 @@ entry: define void @uitofp_double_i32(i32 %a, double %b) nounwind ssp { entry: ; ELF64: uitofp_double_i32 +; ELF64LE: uitofp_double_i32 ; PPC970: uitofp_double_i32 %b.addr = alloca double, align 8 %conv = uitofp i32 %a to double ; ELF64: std +; stack offset used to load the float: 65524 = -16 + 4 +; ELF64: ori {{[0-9]+}}, {{[0-9]+}}, 65524 ; ELF64: lfiwzx ; ELF64: fcfidu +; ELF64LE: std +; stack offset used to load the float: 65520 = -16 + 0 +; ELF64LE: ori {{[0-9]+}}, {{[0-9]+}}, 65520 +; ELF64LE: lfiwzx +; ELF64LE: fcfidu ; PPC970-NOT: lfiwzx ; PPC970-NOT: fcfidu store double %conv, double* %b.addr, align 8 @@ -247,6 +326,7 @@ entry: define void @uitofp_double_i16(i16 %a, double %b) nounwind ssp { entry: ; ELF64: uitofp_double_i16 +; ELF64LE: uitofp_double_i16 ; PPC970: uitofp_double_i16 %b.addr = alloca double, align 8 %conv = uitofp i16 %a to double @@ -254,6 +334,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfidu +; ELF64LE: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48 +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfidu ; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 16, 31 ; PPC970: std ; PPC970: lfd @@ -265,6 +349,7 @@ entry: define void @uitofp_double_i8(i8 %a, double %b) nounwind ssp { entry: ; ELF64: uitofp_double_i8 +; ELF64LE: uitofp_double_i8 ; PPC970: uitofp_double_i8 %b.addr = alloca double, align 8 %conv = uitofp i8 %a to double @@ -272,6 +357,10 @@ entry: ; ELF64: std ; ELF64: lfd ; ELF64: fcfidu +; ELF64LE: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56 +; ELF64LE: std +; ELF64LE: lfd +; ELF64LE: fcfidu ; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 24, 31 ; PPC970: std ; PPC970: lfd @@ -285,12 +374,16 @@ entry: define void @fptosi_float_i32(float %a) nounwind ssp { entry: ; ELF64: fptosi_float_i32 +; ELF64LE: fptosi_float_i32 ; PPC970: fptosi_float_i32 %b.addr = alloca i32, align 4 %conv = fptosi float %a to i32 ; ELF64: fctiwz ; ELF64: stfd ; ELF64: lwa +; ELF64LE: fctiwz +; ELF64LE: stfd +; ELF64LE: lwa ; PPC970: fctiwz ; PPC970: stfd ; PPC970: lwa @@ -301,12 +394,16 @@ entry: define void @fptosi_float_i64(float %a) nounwind ssp { entry: ; ELF64: fptosi_float_i64 +; ELF64LE: fptosi_float_i64 ; PPC970: fptosi_float_i64 %b.addr = alloca i64, align 4 %conv = fptosi float %a to i64 ; ELF64: fctidz ; ELF64: stfd ; ELF64: ld +; ELF64LE: fctidz +; ELF64LE: stfd +; ELF64LE: ld ; PPC970: fctidz ; PPC970: stfd ; PPC970: ld @@ -317,12 +414,16 @@ entry: define void @fptosi_double_i32(double %a) nounwind ssp { entry: ; ELF64: fptosi_double_i32 +; ELF64LE: fptosi_double_i32 ; PPC970: fptosi_double_i32 %b.addr = alloca i32, align 8 %conv = fptosi double %a to i32 ; ELF64: fctiwz ; ELF64: stfd ; ELF64: lwa +; ELF64LE: fctiwz +; ELF64LE: stfd +; ELF64LE: lwa ; PPC970: fctiwz ; PPC970: stfd ; PPC970: lwa @@ -333,12 +434,16 @@ entry: define void @fptosi_double_i64(double %a) nounwind ssp { entry: ; ELF64: fptosi_double_i64 +; ELF64LE: fptosi_double_i64 ; PPC970: fptosi_double_i64 %b.addr = alloca i64, align 8 %conv = fptosi double %a to i64 ; ELF64: fctidz ; ELF64: stfd ; ELF64: ld +; ELF64LE: fctidz +; ELF64LE: stfd +; ELF64LE: ld ; PPC970: fctidz ; PPC970: stfd ; PPC970: ld @@ -351,12 +456,16 @@ entry: define void @fptoui_float_i32(float %a) nounwind ssp { entry: ; ELF64: fptoui_float_i32 +; ELF64LE: fptoui_float_i32 ; PPC970: fptoui_float_i32 %b.addr = alloca i32, align 4 %conv = fptoui float %a to i32 ; ELF64: fctiwuz ; ELF64: stfd ; ELF64: lwz +; ELF64LE: fctiwuz +; ELF64LE: stfd +; ELF64LE: lwz ; PPC970: fctidz ; PPC970: stfd ; PPC970: lwz @@ -367,12 +476,16 @@ entry: define void @fptoui_float_i64(float %a) nounwind ssp { entry: ; ELF64: fptoui_float_i64 +; ELF64LE: fptoui_float_i64 ; PPC970: fptoui_float_i64 %b.addr = alloca i64, align 4 %conv = fptoui float %a to i64 ; ELF64: fctiduz ; ELF64: stfd ; ELF64: ld +; ELF64LE: fctiduz +; ELF64LE: stfd +; ELF64LE: ld ; PPC970-NOT: fctiduz store i64 %conv, i64* %b.addr, align 4 ret void @@ -381,12 +494,16 @@ entry: define void @fptoui_double_i32(double %a) nounwind ssp { entry: ; ELF64: fptoui_double_i32 +; ELF64LE: fptoui_double_i32 ; PPC970: fptoui_double_i32 %b.addr = alloca i32, align 8 %conv = fptoui double %a to i32 ; ELF64: fctiwuz ; ELF64: stfd ; ELF64: lwz +; ELF64LE: fctiwuz +; ELF64LE: stfd +; ELF64LE: lwz ; PPC970: fctidz ; PPC970: stfd ; PPC970: lwz @@ -397,12 +514,16 @@ entry: define void @fptoui_double_i64(double %a) nounwind ssp { entry: ; ELF64: fptoui_double_i64 +; ELF64LE: fptoui_double_i64 ; PPC970: fptoui_double_i64 %b.addr = alloca i64, align 8 %conv = fptoui double %a to i64 ; ELF64: fctiduz ; ELF64: stfd ; ELF64: ld +; ELF64LE: fctiduz +; ELF64LE: stfd +; ELF64LE: ld ; PPC970-NOT: fctiduz store i64 %conv, i64* %b.addr, align 8 ret void diff --git a/test/CodeGen/PowerPC/fast-isel-ret.ll b/test/CodeGen/PowerPC/fast-isel-ret.ll index fa19f8b11fd68..f82de70c92867 100644 --- a/test/CodeGen/PowerPC/fast-isel-ret.ll +++ b/test/CodeGen/PowerPC/fast-isel-ret.ll @@ -1,8 +1,40 @@ ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64 +define zeroext i1 @rettrue() nounwind uwtable ssp { +entry: +; ELF64-LABEL: rettrue +; ELF64: li 3, 1 +; ELF64: blr + ret i1 true +} + +define zeroext i1 @retfalse() nounwind uwtable ssp { +entry: +; ELF64-LABEL: retfalse +; ELF64: li 3, 0 +; ELF64: blr + ret i1 false +} + +define signext i1 @retstrue() nounwind uwtable ssp { +entry: +; ELF64-LABEL: retstrue +; ELF64: li 3, -1 +; ELF64: blr + ret i1 true +} + +define signext i1 @retsfalse() nounwind uwtable ssp { +entry: +; ELF64-LABEL: retsfalse +; ELF64: li 3, 0 +; ELF64: blr + ret i1 false +} + define signext i8 @ret2(i8 signext %a) nounwind uwtable ssp { entry: -; ELF64: ret2 +; ELF64-LABEL: ret2 ; ELF64: extsb ; ELF64: blr ret i8 %a @@ -10,7 +42,7 @@ entry: define zeroext i8 @ret3(i8 signext %a) nounwind uwtable ssp { entry: -; ELF64: ret3 +; ELF64-LABEL: ret3 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56 ; ELF64: blr ret i8 %a @@ -18,7 +50,7 @@ entry: define signext i16 @ret4(i16 signext %a) nounwind uwtable ssp { entry: -; ELF64: ret4 +; ELF64-LABEL: ret4 ; ELF64: extsh ; ELF64: blr ret i16 %a @@ -26,7 +58,7 @@ entry: define zeroext i16 @ret5(i16 signext %a) nounwind uwtable ssp { entry: -; ELF64: ret5 +; ELF64-LABEL: ret5 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48 ; ELF64: blr ret i16 %a @@ -34,7 +66,7 @@ entry: define i16 @ret6(i16 %a) nounwind uwtable ssp { entry: -; ELF64: ret6 +; ELF64-LABEL: ret6 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48 ; ELF64: blr ret i16 %a @@ -42,7 +74,7 @@ entry: define signext i32 @ret7(i32 signext %a) nounwind uwtable ssp { entry: -; ELF64: ret7 +; ELF64-LABEL: ret7 ; ELF64: extsw ; ELF64: blr ret i32 %a @@ -50,7 +82,7 @@ entry: define zeroext i32 @ret8(i32 signext %a) nounwind uwtable ssp { entry: -; ELF64: ret8 +; ELF64-LABEL: ret8 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 32 ; ELF64: blr ret i32 %a @@ -58,7 +90,7 @@ entry: define i32 @ret9(i32 %a) nounwind uwtable ssp { entry: -; ELF64: ret9 +; ELF64-LABEL: ret9 ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 32 ; ELF64: blr ret i32 %a @@ -66,7 +98,7 @@ entry: define i64 @ret10(i64 %a) nounwind uwtable ssp { entry: -; ELF64: ret10 +; ELF64-LABEL: ret10 ; ELF64-NOT: exts ; ELF64-NOT: rldicl ; ELF64: blr @@ -75,21 +107,21 @@ entry: define float @ret11(float %a) nounwind uwtable ssp { entry: -; ELF64: ret11 +; ELF64-LABEL: ret11 ; ELF64: blr ret float %a } define double @ret12(double %a) nounwind uwtable ssp { entry: -; ELF64: ret12 +; ELF64-LABEL: ret12 ; ELF64: blr ret double %a } define i8 @ret13() nounwind uwtable ssp { entry: -; ELF64: ret13 +; ELF64-LABEL: ret13 ; ELF64: li ; ELF64: blr ret i8 15; @@ -97,7 +129,7 @@ entry: define i16 @ret14() nounwind uwtable ssp { entry: -; ELF64: ret14 +; ELF64-LABEL: ret14 ; ELF64: li ; ELF64: blr ret i16 -225; @@ -105,7 +137,7 @@ entry: define i32 @ret15() nounwind uwtable ssp { entry: -; ELF64: ret15 +; ELF64-LABEL: ret15 ; ELF64: lis ; ELF64: ori ; ELF64: blr @@ -114,7 +146,7 @@ entry: define i64 @ret16() nounwind uwtable ssp { entry: -; ELF64: ret16 +; ELF64-LABEL: ret16 ; ELF64: li ; ELF64: sldi ; ELF64: oris @@ -125,7 +157,7 @@ entry: define float @ret17() nounwind uwtable ssp { entry: -; ELF64: ret17 +; ELF64-LABEL: ret17 ; ELF64: addis ; ELF64: lfs ; ELF64: blr @@ -134,7 +166,7 @@ entry: define double @ret18() nounwind uwtable ssp { entry: -; ELF64: ret18 +; ELF64-LABEL: ret18 ; ELF64: addis ; ELF64: lfd ; ELF64: blr diff --git a/test/CodeGen/PowerPC/ia-mem-r0.ll b/test/CodeGen/PowerPC/ia-mem-r0.ll new file mode 100644 index 0000000000000..4ab17edc5b10d --- /dev/null +++ b/test/CodeGen/PowerPC/ia-mem-r0.ll @@ -0,0 +1,94 @@ +; RUN: llc -mcpu=pwr7 < %s | FileCheck %s +target datalayout = "e-m:e-i64:64-n32:64" +target triple = "powerpc64le-unknown-linux-gnu" + +; Make sure that we don't generate a std r, 0(0) -- the memory address cannot +; be stored in r0. +; CHECK-LABEL: @test1 +; CHECK-NOT: std {{[0-9]+}}, 0(0) +; CHECK: blr + +define void @test1({ i8*, void (i8*, i8*)* } %fn_arg) { + %fn = alloca { i8*, void (i8*, i8*)* } + %sp = alloca i8*, align 8 + %regs = alloca [18 x i64], align 8 + store { i8*, void (i8*, i8*)* } %fn_arg, { i8*, void (i8*, i8*)* }* %fn + %1 = bitcast [18 x i64]* %regs to i64* + call void asm sideeffect "std 14, $0", "=*m"(i64* %1) + %2 = bitcast [18 x i64]* %regs to i8* + %3 = getelementptr i8* %2, i32 8 + %4 = bitcast i8* %3 to i64* + call void asm sideeffect "std 15, $0", "=*m"(i64* %4) + %5 = bitcast [18 x i64]* %regs to i8* + %6 = getelementptr i8* %5, i32 16 + %7 = bitcast i8* %6 to i64* + call void asm sideeffect "std 16, $0", "=*m"(i64* %7) + %8 = bitcast [18 x i64]* %regs to i8* + %9 = getelementptr i8* %8, i32 24 + %10 = bitcast i8* %9 to i64* + call void asm sideeffect "std 17, $0", "=*m"(i64* %10) + %11 = bitcast [18 x i64]* %regs to i8* + %12 = getelementptr i8* %11, i32 32 + %13 = bitcast i8* %12 to i64* + call void asm sideeffect "std 18, $0", "=*m"(i64* %13) + %14 = bitcast [18 x i64]* %regs to i8* + %15 = getelementptr i8* %14, i32 40 + %16 = bitcast i8* %15 to i64* + call void asm sideeffect "std 19, $0", "=*m"(i64* %16) + %17 = bitcast [18 x i64]* %regs to i8* + %18 = getelementptr i8* %17, i32 48 + %19 = bitcast i8* %18 to i64* + call void asm sideeffect "std 20, $0", "=*m"(i64* %19) + %20 = bitcast [18 x i64]* %regs to i8* + %21 = getelementptr i8* %20, i32 56 + %22 = bitcast i8* %21 to i64* + call void asm sideeffect "std 21, $0", "=*m"(i64* %22) + %23 = bitcast [18 x i64]* %regs to i8* + %24 = getelementptr i8* %23, i32 64 + %25 = bitcast i8* %24 to i64* + call void asm sideeffect "std 22, $0", "=*m"(i64* %25) + %26 = bitcast [18 x i64]* %regs to i8* + %27 = getelementptr i8* %26, i32 72 + %28 = bitcast i8* %27 to i64* + call void asm sideeffect "std 23, $0", "=*m"(i64* %28) + %29 = bitcast [18 x i64]* %regs to i8* + %30 = getelementptr i8* %29, i32 80 + %31 = bitcast i8* %30 to i64* + call void asm sideeffect "std 24, $0", "=*m"(i64* %31) + %32 = bitcast [18 x i64]* %regs to i8* + %33 = getelementptr i8* %32, i32 88 + %34 = bitcast i8* %33 to i64* + call void asm sideeffect "std 25, $0", "=*m"(i64* %34) + %35 = bitcast [18 x i64]* %regs to i8* + %36 = getelementptr i8* %35, i32 96 + %37 = bitcast i8* %36 to i64* + call void asm sideeffect "std 26, $0", "=*m"(i64* %37) + %38 = bitcast [18 x i64]* %regs to i8* + %39 = getelementptr i8* %38, i32 104 + %40 = bitcast i8* %39 to i64* + call void asm sideeffect "std 27, $0", "=*m"(i64* %40) + %41 = bitcast [18 x i64]* %regs to i8* + %42 = getelementptr i8* %41, i32 112 + %43 = bitcast i8* %42 to i64* + call void asm sideeffect "std 28, $0", "=*m"(i64* %43) + %44 = bitcast [18 x i64]* %regs to i8* + %45 = getelementptr i8* %44, i32 120 + %46 = bitcast i8* %45 to i64* + call void asm sideeffect "std 29, $0", "=*m"(i64* %46) + %47 = bitcast [18 x i64]* %regs to i8* + %48 = getelementptr i8* %47, i32 128 + %49 = bitcast i8* %48 to i64* + call void asm sideeffect "std 30, $0", "=*m"(i64* %49) + %50 = bitcast [18 x i64]* %regs to i8* + %51 = getelementptr i8* %50, i32 136 + %52 = bitcast i8* %51 to i64* + call void asm sideeffect "std 31, $0", "=*m"(i64* %52) + %53 = getelementptr { i8*, void (i8*, i8*)* }* %fn, i32 0, i32 1 + %.funcptr = load void (i8*, i8*)** %53 + %54 = getelementptr { i8*, void (i8*, i8*)* }* %fn, i32 0, i32 0 + %.ptr = load i8** %54 + %55 = load i8** %sp + call void %.funcptr(i8* %.ptr, i8* %55) + ret void +} + diff --git a/test/CodeGen/PowerPC/ia-neg-const.ll b/test/CodeGen/PowerPC/ia-neg-const.ll new file mode 100644 index 0000000000000..165fc1339d0be --- /dev/null +++ b/test/CodeGen/PowerPC/ia-neg-const.ll @@ -0,0 +1,25 @@ +; RUN: llc -mcpu=pwr7 < %s | FileCheck %s +target datalayout = "E-m:e-i64:64-n32:64" +target triple = "powerpc64-unknown-linux-gnu" + +@.str = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 + +; Function Attrs: nounwind +define i64 @main() #0 { +entry: + %x = alloca i64, align 8 + store i64 0, i64* %x, align 8 + %0 = call i64 asm sideeffect "ld $0,$1\0A\09add${2:I} $0,$0,$2", "=&r,*m,Ir"(i64* %x, i64 -1) #0 + ret i64 %0 +} + +; CHECK: ld +; CHECK-NOT: addi 3,3,4294967295 +; CHECK: addi 3,3,-1 +; CHECK: blr + +; Function Attrs: nounwind +declare signext i32 @printf(i8* nocapture readonly, ...) #0 + +attributes #0 = { nounwind } + diff --git a/test/CodeGen/PowerPC/stack-realign.ll b/test/CodeGen/PowerPC/stack-realign.ll index a59fceb5bdd08..762f50a9cbe0b 100644 --- a/test/CodeGen/PowerPC/stack-realign.ll +++ b/test/CodeGen/PowerPC/stack-realign.ll @@ -37,6 +37,7 @@ entry: ; CHECK-DAG: subfic 0, [[REG]], -160 ; CHECK: stdux 1, 1, 0 +; CHECK: .cfi_def_cfa_register r30 ; CHECK: .cfi_offset r30, -16 ; CHECK: .cfi_offset lr, 16 @@ -59,6 +60,7 @@ entry: ; CHECK-FP-DAG: subfic 0, [[REG]], -160 ; CHECK-FP: stdux 1, 1, 0 +; CHECK-FP: .cfi_def_cfa_register r30 ; CHECK-FP: .cfi_offset r31, -8 ; CHECK-FP: .cfi_offset r30, -16 ; CHECK-FP: .cfi_offset lr, 16 @@ -120,6 +122,8 @@ entry: ; CHECK-DAG: subfc 0, [[REG3]], [[REG2]] ; CHECK: stdux 1, 1, 0 +; CHECK: .cfi_def_cfa_register r30 + ; CHECK: blr ; CHECK-32-LABEL: @hoo @@ -178,6 +182,8 @@ entry: ; CHECK-DAG: subfic 0, [[REG]], -192 ; CHECK: stdux 1, 1, 0 +; CHECK: .cfi_def_cfa_register r30 + ; CHECK: stfd 30, -16(30) ; CHECK: blr @@ -193,6 +199,8 @@ entry: ; CHECK-FP-DAG: subfic 0, [[REG]], -192 ; CHECK-FP: stdux 1, 1, 0 +; CHECK-FP: .cfi_def_cfa_register r30 + ; CHECK-FP: stfd 30, -16(30) ; CHECK-FP: blr diff --git a/test/CodeGen/PowerPC/subreg-postra-2.ll b/test/CodeGen/PowerPC/subreg-postra-2.ll new file mode 100644 index 0000000000000..2faaa61292944 --- /dev/null +++ b/test/CodeGen/PowerPC/subreg-postra-2.ll @@ -0,0 +1,175 @@ +; RUN: llc -mcpu=pwr7 < %s | FileCheck %s +target datalayout = "E-m:e-i64:64-n32:64" +target triple = "powerpc64-unknown-linux-gnu" + +; Function Attrs: nounwind +define void @jbd2_journal_commit_transaction() #0 { +entry: + br i1 undef, label %do.body, label %if.then5 + +if.then5: ; preds = %entry + unreachable + +do.body: ; preds = %entry + br i1 undef, label %do.body.i, label %trace_jbd2_start_commit.exit + +do.body.i: ; preds = %do.body + unreachable + +trace_jbd2_start_commit.exit: ; preds = %do.body + br i1 undef, label %do.body.i1116, label %trace_jbd2_commit_locking.exit + +do.body.i1116: ; preds = %trace_jbd2_start_commit.exit + unreachable + +trace_jbd2_commit_locking.exit: ; preds = %trace_jbd2_start_commit.exit + br i1 undef, label %while.end, label %while.body.lr.ph + +while.body.lr.ph: ; preds = %trace_jbd2_commit_locking.exit + unreachable + +while.end: ; preds = %trace_jbd2_commit_locking.exit + br i1 undef, label %spin_unlock.exit1146, label %if.then.i.i.i.i1144 + +if.then.i.i.i.i1144: ; preds = %while.end + unreachable + +spin_unlock.exit1146: ; preds = %while.end + br i1 undef, label %spin_unlock.exit1154, label %if.then.i.i.i.i1152 + +if.then.i.i.i.i1152: ; preds = %spin_unlock.exit1146 + unreachable + +spin_unlock.exit1154: ; preds = %spin_unlock.exit1146 + br i1 undef, label %do.body.i1159, label %trace_jbd2_commit_flushing.exit + +do.body.i1159: ; preds = %spin_unlock.exit1154 + br i1 undef, label %if.end.i1166, label %do.body5.i1165 + +do.body5.i1165: ; preds = %do.body.i1159 + unreachable + +if.end.i1166: ; preds = %do.body.i1159 + unreachable + +trace_jbd2_commit_flushing.exit: ; preds = %spin_unlock.exit1154 + br i1 undef, label %for.end.i, label %for.body.lr.ph.i + +for.body.lr.ph.i: ; preds = %trace_jbd2_commit_flushing.exit + unreachable + +for.end.i: ; preds = %trace_jbd2_commit_flushing.exit + br i1 undef, label %journal_submit_data_buffers.exit, label %if.then.i.i.i.i31.i + +if.then.i.i.i.i31.i: ; preds = %for.end.i + br label %journal_submit_data_buffers.exit + +journal_submit_data_buffers.exit: ; preds = %if.then.i.i.i.i31.i, %for.end.i + br i1 undef, label %if.end103, label %if.then102 + +if.then102: ; preds = %journal_submit_data_buffers.exit + unreachable + +if.end103: ; preds = %journal_submit_data_buffers.exit + br i1 undef, label %do.body.i1182, label %trace_jbd2_commit_logging.exit + +do.body.i1182: ; preds = %if.end103 + br i1 undef, label %if.end.i1189, label %do.body5.i1188 + +do.body5.i1188: ; preds = %do.body5.i1188, %do.body.i1182 + br i1 undef, label %if.end.i1189, label %do.body5.i1188 + +if.end.i1189: ; preds = %do.body5.i1188, %do.body.i1182 + unreachable + +trace_jbd2_commit_logging.exit: ; preds = %if.end103 + br label %while.cond129.outer1451 + +while.cond129.outer1451: ; preds = %start_journal_io, %trace_jbd2_commit_logging.exit + br label %while.cond129 + +while.cond129: ; preds = %if.then135, %while.cond129.outer1451 + br i1 undef, label %while.end246, label %if.then135 + +if.then135: ; preds = %while.cond129 + br i1 undef, label %start_journal_io, label %while.cond129 + +start_journal_io: ; preds = %if.then135 + br label %while.cond129.outer1451 + +while.end246: ; preds = %while.cond129 + br i1 undef, label %for.end.i1287, label %for.body.i1277 + +for.body.i1277: ; preds = %while.end246 + unreachable + +for.end.i1287: ; preds = %while.end246 + br i1 undef, label %journal_finish_inode_data_buffers.exit, label %if.then.i.i.i.i84.i + +if.then.i.i.i.i84.i: ; preds = %for.end.i1287 + unreachable + +journal_finish_inode_data_buffers.exit: ; preds = %for.end.i1287 + br i1 undef, label %if.end256, label %if.then249 + +if.then249: ; preds = %journal_finish_inode_data_buffers.exit + unreachable + +if.end256: ; preds = %journal_finish_inode_data_buffers.exit + br label %while.body318 + +while.body318: ; preds = %wait_on_buffer.exit, %if.end256 + br i1 undef, label %wait_on_buffer.exit, label %if.then.i1296 + +if.then.i1296: ; preds = %while.body318 + br label %wait_on_buffer.exit + +wait_on_buffer.exit: ; preds = %if.then.i1296, %while.body318 + br i1 undef, label %do.body378, label %while.body318 + +do.body378: ; preds = %wait_on_buffer.exit + br i1 undef, label %while.end418, label %while.body392.lr.ph + +while.body392.lr.ph: ; preds = %do.body378 + br label %while.body392 + +while.body392: ; preds = %wait_on_buffer.exit1319, %while.body392.lr.ph + %0 = load i8** undef, align 8 + %add.ptr399 = getelementptr inbounds i8* %0, i64 -72 + %b_state.i.i1314 = bitcast i8* %add.ptr399 to i64* + %tobool.i1316 = icmp eq i64 undef, 0 + br i1 %tobool.i1316, label %wait_on_buffer.exit1319, label %if.then.i1317 + +if.then.i1317: ; preds = %while.body392 + unreachable + +wait_on_buffer.exit1319: ; preds = %while.body392 + %1 = load volatile i64* %b_state.i.i1314, align 8 + %conv.i.i1322 = and i64 %1, 1 + %lnot404 = icmp eq i64 %conv.i.i1322, 0 + %.err.4 = select i1 %lnot404, i32 -5, i32 undef + %2 = call i64 asm sideeffect "1:.long 0x7c0000a8 $| ((($0) & 0x1f) << 21) $| (((0) & 0x1f) << 16) $| ((($3) & 0x1f) << 11) $| (((0) & 0x1) << 0) \0Aandc $0,$0,$2\0Astdcx. $0,0,$3\0Abne- 1b\0A", "=&r,=*m,r,r,*m,~{cc},~{memory}"(i64* %b_state.i.i1314, i64 262144, i64* %b_state.i.i1314, i64* %b_state.i.i1314) #0 + store i8* %0, i8** undef, align 8 + %cmp.i1312 = icmp eq i32* undef, undef + br i1 %cmp.i1312, label %while.end418, label %while.body392 + +while.end418: ; preds = %wait_on_buffer.exit1319, %do.body378 + %err.4.lcssa = phi i32 [ undef, %do.body378 ], [ %.err.4, %wait_on_buffer.exit1319 ] + %tobool419 = icmp eq i32 %err.4.lcssa, 0 + br i1 %tobool419, label %if.end421, label %if.then420 + +; CHECK-LABEL: @jbd2_journal_commit_transaction +; CHECK: andi. +; CHECK: cror [[REG:[0-9]+]], 1, 1 +; CHECK: stdcx. +; CHECK: isel {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}, [[REG]] + +if.then420: ; preds = %while.end418 + unreachable + +if.end421: ; preds = %while.end418 + unreachable +} + +attributes #0 = { nounwind } + diff --git a/test/CodeGen/PowerPC/subreg-postra.ll b/test/CodeGen/PowerPC/subreg-postra.ll new file mode 100644 index 0000000000000..b10fa668cb8df --- /dev/null +++ b/test/CodeGen/PowerPC/subreg-postra.ll @@ -0,0 +1,168 @@ +; RUN: llc -mcpu=pwr7 < %s | FileCheck %s +target datalayout = "E-m:e-i64:64-n32:64" +target triple = "powerpc64-unknown-linux-gnu" + +; Function Attrs: nounwind +define void @jbd2_journal_commit_transaction(i32* %journal) #0 { +entry: + br i1 undef, label %do.body, label %if.then5 + +if.then5: ; preds = %entry + unreachable + +do.body: ; preds = %entry + br i1 undef, label %do.body.i, label %trace_jbd2_start_commit.exit + +do.body.i: ; preds = %do.body + unreachable + +trace_jbd2_start_commit.exit: ; preds = %do.body + br i1 undef, label %do.body.i1116, label %trace_jbd2_commit_locking.exit + +do.body.i1116: ; preds = %trace_jbd2_start_commit.exit + br i1 undef, label %if.end.i1123, label %do.body5.i1122 + +do.body5.i1122: ; preds = %do.body.i1116 + unreachable + +if.end.i1123: ; preds = %do.body.i1116 + br label %trace_jbd2_commit_locking.exit + +trace_jbd2_commit_locking.exit: ; preds = %if.end.i1123, %trace_jbd2_start_commit.exit + br i1 undef, label %spin_unlock.exit1146, label %if.then.i.i.i.i1144 + +if.then.i.i.i.i1144: ; preds = %trace_jbd2_commit_locking.exit + unreachable + +spin_unlock.exit1146: ; preds = %trace_jbd2_commit_locking.exit + br i1 undef, label %spin_unlock.exit1154, label %if.then.i.i.i.i1152 + +if.then.i.i.i.i1152: ; preds = %spin_unlock.exit1146 + br label %spin_unlock.exit1154 + +spin_unlock.exit1154: ; preds = %if.then.i.i.i.i1152, %spin_unlock.exit1146 + br i1 undef, label %do.body.i1159, label %trace_jbd2_commit_flushing.exit + +do.body.i1159: ; preds = %spin_unlock.exit1154 + unreachable + +trace_jbd2_commit_flushing.exit: ; preds = %spin_unlock.exit1154 + br i1 undef, label %for.end.i, label %for.body.lr.ph.i + +for.body.lr.ph.i: ; preds = %trace_jbd2_commit_flushing.exit + br i1 undef, label %spin_unlock.exit.i, label %if.then.i.i.i.i.i + +if.then.i.i.i.i.i: ; preds = %for.body.lr.ph.i + unreachable + +spin_unlock.exit.i: ; preds = %for.body.lr.ph.i + unreachable + +for.end.i: ; preds = %trace_jbd2_commit_flushing.exit + br i1 undef, label %journal_submit_data_buffers.exit, label %if.then.i.i.i.i31.i + +if.then.i.i.i.i31.i: ; preds = %for.end.i + unreachable + +journal_submit_data_buffers.exit: ; preds = %for.end.i + br i1 undef, label %if.end103, label %if.then102 + +if.then102: ; preds = %journal_submit_data_buffers.exit + unreachable + +if.end103: ; preds = %journal_submit_data_buffers.exit + br i1 undef, label %do.body.i1182, label %trace_jbd2_commit_logging.exit + +do.body.i1182: ; preds = %if.end103 + unreachable + +trace_jbd2_commit_logging.exit: ; preds = %if.end103 + br i1 undef, label %for.end.i1287, label %for.body.i1277 + +for.body.i1277: ; preds = %trace_jbd2_commit_logging.exit + unreachable + +for.end.i1287: ; preds = %trace_jbd2_commit_logging.exit + br i1 undef, label %journal_finish_inode_data_buffers.exit, label %if.then.i.i.i.i84.i + +if.then.i.i.i.i84.i: ; preds = %for.end.i1287 + unreachable + +journal_finish_inode_data_buffers.exit: ; preds = %for.end.i1287 + br i1 undef, label %if.end256, label %if.then249 + +if.then249: ; preds = %journal_finish_inode_data_buffers.exit + unreachable + +if.end256: ; preds = %journal_finish_inode_data_buffers.exit + br i1 undef, label %do.body277, label %if.then260 + +if.then260: ; preds = %if.end256 + br label %do.body277 + +do.body277: ; preds = %if.then260, %if.end256 + br label %while.body318 + +while.body318: ; preds = %wait_on_buffer.exit, %do.body277 + %tobool.i1295 = icmp eq i64 undef, 0 + br i1 %tobool.i1295, label %wait_on_buffer.exit, label %if.then.i1296 + +if.then.i1296: ; preds = %while.body318 + unreachable + +wait_on_buffer.exit: ; preds = %while.body318 + br i1 undef, label %do.body378, label %while.body318 + +do.body378: ; preds = %wait_on_buffer.exit + br i1 undef, label %while.end418, label %while.body392.lr.ph + +while.body392.lr.ph: ; preds = %do.body378 + br label %while.body392 + +while.body392: ; preds = %wait_on_buffer.exit1319, %while.body392.lr.ph + %0 = load i8** undef, align 8 + %add.ptr399 = getelementptr inbounds i8* %0, i64 -72 + %b_state.i.i1314 = bitcast i8* %add.ptr399 to i64* + %tobool.i1316 = icmp eq i64 undef, 0 + br i1 %tobool.i1316, label %wait_on_buffer.exit1319, label %if.then.i1317 + +if.then.i1317: ; preds = %while.body392 + unreachable + +wait_on_buffer.exit1319: ; preds = %while.body392 + %1 = load volatile i64* %b_state.i.i1314, align 8 + %conv.i.i1322 = and i64 %1, 1 + %lnot404 = icmp eq i64 %conv.i.i1322, 0 + %.err.4 = select i1 %lnot404, i32 -5, i32 undef + %2 = call i64 asm sideeffect "1:.long 0x7c0000a8 $| ((($0) & 0x1f) << 21) $| (((0) & 0x1f) << 16) $| ((($3) & 0x1f) << 11) $| (((0) & 0x1) << 0) \0Aandc $0,$0,$2\0Astdcx. $0,0,$3\0Abne- 1b\0A", "=&r,=*m,r,r,*m,~{cc},~{memory}"(i64* %b_state.i.i1314, i64 262144, i64* %b_state.i.i1314, i64* %b_state.i.i1314) #1 + %prev.i.i.i1325 = getelementptr inbounds i8* %0, i64 8 + %3 = load i32** null, align 8 + store i32* %3, i32** undef, align 8 + call void @__brelse(i32* undef) #1 + br i1 undef, label %while.end418, label %while.body392 + +; CHECK-LABEL: @jbd2_journal_commit_transaction +; CHECK: andi. +; CHECK: cror [[REG:[0-9]+]], 1, 1 +; CHECK: stdcx. +; CHECK: isel {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}, [[REG]] + +while.end418: ; preds = %wait_on_buffer.exit1319, %do.body378 + %err.4.lcssa = phi i32 [ undef, %do.body378 ], [ %.err.4, %wait_on_buffer.exit1319 ] + br i1 undef, label %if.end421, label %if.then420 + +if.then420: ; preds = %while.end418 + call void @jbd2_journal_abort(i32* %journal, i32 signext %err.4.lcssa) #1 + br label %if.end421 + +if.end421: ; preds = %if.then420, %while.end418 + unreachable +} + +declare void @jbd2_journal_abort(i32*, i32 signext) + +declare void @__brelse(i32*) + +attributes #0 = { nounwind } +attributes #1 = { nounwind } + diff --git a/test/CodeGen/PowerPC/tls-pic.ll b/test/CodeGen/PowerPC/tls-pic.ll index 9f3ab6e3b4916..9ba372591e6ec 100644 --- a/test/CodeGen/PowerPC/tls-pic.ll +++ b/test/CodeGen/PowerPC/tls-pic.ll @@ -1,5 +1,7 @@ ; RUN: llc -march=ppc64 -mcpu=pwr7 -O0 -relocation-model=pic < %s | FileCheck -check-prefix=OPT0 %s ; RUN: llc -march=ppc64 -mcpu=pwr7 -O1 -relocation-model=pic < %s | FileCheck -check-prefix=OPT1 %s +; RUN: llc -march=ppc32 -O0 -relocation-model=pic < %s | FileCheck -check-prefix=OPT0-32 %s +; RUN: llc -march=ppc32 -O1 -relocation-model=pic < %s | FileCheck -check-prefix=OPT1-32 %s target triple = "powerpc64-unknown-linux-gnu" ; Test correct assembly code generation for thread-local storage using @@ -22,6 +24,16 @@ entry: ; OPT0-NEXT: nop ; OPT0: addis [[REG2:[0-9]+]], 3, a@dtprel@ha ; OPT0-NEXT: addi {{[0-9]+}}, [[REG2]], a@dtprel@l +; OPT0-32-LABEL: main +; OPT0-32: addi {{[0-9]+}}, {{[0-9]+}}, a@got@tlsld +; OPT0-32: bl __tls_get_addr(a@tlsld)@PLT +; OPT0-32: addis [[REG:[0-9]+]], 3, a@dtprel@ha +; OPT0-32-NEXT: addi {{[0-9]+}}, [[REG]], a@dtprel@l +; OPT1-32-LABEL: main +; OPT1-32: addi 3, {{[0-9]+}}, a@got@tlsld +; OPT1-32: bl __tls_get_addr(a@tlsld)@PLT +; OPT1-32: addis [[REG:[0-9]+]], 3, a@dtprel@ha +; OPT1-32-NEXT: addi {{[0-9]+}}, [[REG]], a@dtprel@l ; Test peephole optimization for thread-local storage using the ; local dynamic model. @@ -52,4 +64,6 @@ entry: ; OPT1-NEXT: addi 3, [[REG]], a2@got@tlsgd@l ; OPT1: bl __tls_get_addr(a2@tlsgd) ; OPT1-NEXT: nop - +; OPT1-32-LABEL: main2 +; OPT1-32: addi 3, {{[0-9]+}}, a2@got@tlsgd +; OPT1-32: bl __tls_get_addr(a2@tlsgd)@PLT diff --git a/test/CodeGen/PowerPC/tls-store2.ll b/test/CodeGen/PowerPC/tls-store2.ll new file mode 100644 index 0000000000000..f884dd8a0a17b --- /dev/null +++ b/test/CodeGen/PowerPC/tls-store2.ll @@ -0,0 +1,33 @@ +; RUN: llc -march=ppc64 -mcpu=pwr7 -O2 -relocation-model=pic < %s | FileCheck %s + +target datalayout = "e-m:e-i64:64-n32:64" +target triple = "powerpc64le-unknown-linux-gnu" + +; Test back-to-back stores of TLS variables to ensure call sequences no +; longer overlap. + +@__once_callable = external thread_local global i8** +@__once_call = external thread_local global void ()* + +define i64 @call_once(i64 %flag, i8* %ptr) { +entry: + %var = alloca i8*, align 8 + store i8* %ptr, i8** %var, align 8 + store i8** %var, i8*** @__once_callable, align 8 + store void ()* @__once_call_impl, void ()** @__once_call, align 8 + ret i64 %flag +} + +; CHECK-LABEL: call_once: +; CHECK: addis 3, 2, __once_callable@got@tlsgd@ha +; CHECK: addi 3, 3, __once_callable@got@tlsgd@l +; CHECK: bl __tls_get_addr(__once_callable@tlsgd) +; CHECK-NEXT: nop +; CHECK: std {{[0-9]+}}, 0(3) +; CHECK: addis 3, 2, __once_call@got@tlsgd@ha +; CHECK: addi 3, 3, __once_call@got@tlsgd@l +; CHECK: bl __tls_get_addr(__once_call@tlsgd) +; CHECK-NEXT: nop +; CHECK: std {{[0-9]+}}, 0(3) + +declare void @__once_call_impl() |
