| 1 |
; RUN: llc -mcpu=pwr7 -ppc-asm-full-reg-names -mtriple=powerpc-- \ |
| 2 |
; RUN: -verify-machineinstrs < %s | FileCheck %s |
| 3 |
; RUN: llc -mattr=allow-unaligned-fp-access -ppc-asm-full-reg-names \ |
| 4 |
; RUN: -mtriple=powerpc-- -verify-machineinstrs < %s | FileCheck %s |
| 5 |
; RUN: llc -ppc-asm-full-reg-names -mtriple=powerpc-- \ |
| 6 |
; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefix=UNALIGN |
| 7 |
|
| 8 |
; Test case as provided by author in https://bugs.llvm.org/show_bug.cgi?id=40554 |
| 9 |
%struct.anon = type { i32, [5 x i8] } |
| 10 |
|
| 11 |
@s = dso_local local_unnamed_addr global %struct.anon { i32 0, [5 x i8] c"\00B\F6\E9y" }, align 4 |
| 12 |
@.str = private unnamed_addr constant [4 x i8] c"%g\0A\00", align 1 |
| 13 |
; Function Attrs: nofree nounwind |
| 14 |
define dso_local i32 @main() local_unnamed_addr { |
| 15 |
; CHECK-LABEL: main: |
| 16 |
; CHECK: lfs f1, 5(r3) |
| 17 |
; CHECK: blr |
| 18 |
; |
| 19 |
; UNALIGN-LABEL: main: |
| 20 |
; UNALIGN: lfs f1, 12(r1) |
| 21 |
; UNALIGN: blr |
| 22 |
entry: |
| 23 |
%0 = load i8, ptr getelementptr inbounds (%struct.anon, ptr @s, i32 0, i32 1, i32 1), align 1 |
| 24 |
%conv = zext i8 %0 to i32 |
| 25 |
%shl = shl nuw i32 %conv, 24 |
| 26 |
%1 = load i8, ptr getelementptr inbounds (%struct.anon, ptr @s, i32 0, i32 1, i32 2), align 2 |
| 27 |
%conv1 = zext i8 %1 to i32 |
| 28 |
%shl2 = shl nuw nsw i32 %conv1, 16 |
| 29 |
%add = or i32 %shl2, %shl |
| 30 |
%2 = load i8, ptr getelementptr inbounds (%struct.anon, ptr @s, i32 0, i32 1, i32 3), align 1 |
| 31 |
%conv3 = zext i8 %2 to i32 |
| 32 |
%shl4 = shl nuw nsw i32 %conv3, 8 |
| 33 |
%add5 = or i32 %add, %shl4 |
| 34 |
%3 = load i8, ptr getelementptr inbounds (%struct.anon, ptr @s, i32 0, i32 1, i32 4), align 4 |
| 35 |
%conv6 = zext i8 %3 to i32 |
| 36 |
%add7 = or i32 %add5, %conv6 |
| 37 |
%4 = bitcast i32 %add7 to float |
| 38 |
%conv8 = fpext float %4 to double |
| 39 |
%call = tail call i32 (ptr, ...) @printf(ptr nonnull dereferenceable(1) @.str, double %conv8) |
| 40 |
ret i32 0 |
| 41 |
} |
| 42 |
; Function Attrs: nofree nounwind |
| 43 |
declare i32 @printf(ptr nocapture readonly, ...) local_unnamed_addr |