Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN:   < %s | FileCheck %s --check-prefixes=CHECK,CHECK-P10,CHECK-LE,CHECK-P10-LE
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN:   < %s | FileCheck %s --check-prefixes=CHECK,CHECK-P10,CHECK-BE,CHECK-P10-BE
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN:   -mcpu=pwr9 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN:   < %s | FileCheck %s --check-prefixes=CHECK,CHECK-PREP10,CHECK-P9,CHECK-LE,CHECK-P9-LE
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
; RUN:   -mcpu=pwr9 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN:   < %s | FileCheck %s --check-prefixes=CHECK,CHECK-PREP10,CHECK-P9,CHECK-BE,CHECK-P9-BE
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN:   -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN:   < %s | FileCheck %s --check-prefixes=CHECK,CHECK-PREP10,CHECK-P8,CHECK-LE,CHECK-P8-LE
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
; RUN:   -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN:   < %s | FileCheck %s --check-prefixes=CHECK,CHECK-PREP10,CHECK-P8,CHECK-BE,CHECK-P8-BE

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_0_int16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_0_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align16_int16_t_int8_t(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 8(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align32_int16_t_int8_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_int16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plbz r3, 99999000(r3), 0
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_int16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align64_int16_t_int8_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_int16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lbzx r3, r3, r4
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_int16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_reg_int16_t_int8_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbzx r3, r3, r4
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_or_int16_t_int8_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv1 = sext i8 %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint16_int16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align16_int16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lbz r3, 24(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 8
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint32_int16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align32_int16_t_int8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_int16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plbz r3, 999990000(r3), 0
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_int16_t_int8_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lbzx r3, r3, r4
; CHECK-P9-NEXT:    extsb r3, r3
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_int16_t_int8_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lbzx r3, r3, r4
; CHECK-P8-NEXT:    extsb r3, r3
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 16
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint64_int16_t_int8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_int16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lbz r3, 0(r3)
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_int16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lbz r3, 0(r3)
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align64_int16_t_int8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_int16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lbzx r3, r3, r4
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_int16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 4096
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align16_int16_t_int8_t() {
; CHECK-LABEL: ld_cst_align16_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 4080(0)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 4080 to i8*), align 16
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align32_int16_t_int8_t() {
; CHECK-LABEL: ld_cst_align32_int16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lbz r3, -27108(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 9999900 to i8*), align 4
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align64_int16_t_int8_t() {
; CHECK-P10-LABEL: ld_cst_align64_int16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lbz r3, 0(r3)
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_int16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lbz r3, 0(r3)
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 1000000000000 to i8*), align 4096
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_0_int16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_0_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lha r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align16_int16_t_uint16_t(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lha r3, 8(r3)
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align32_int16_t_uint16_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_int16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plha r3, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_int16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lhax r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align64_int16_t_uint16_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_int16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lhax r3, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_int16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lhax r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_reg_int16_t_uint16_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lhax r3, r3, r4
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_or_int16_t_uint16_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lha r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint16_int16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lha r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align16_int16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lha r3, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 8
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint32_int16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lha r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align32_int16_t_uint16_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_int16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plha r3, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_int16_t_uint16_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lhax r3, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_int16_t_uint16_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lhax r3, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 16
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint64_int16_t_uint16_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_int16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lha r3, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_int16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lha r3, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align64_int16_t_uint16_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_int16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lhax r3, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_int16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lhax r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 4096
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align16_int16_t_uint16_t() {
; CHECK-LABEL: ld_cst_align16_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lha r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %0 = load i16, i16* inttoptr (i64 4080 to i16*), align 16
  ret i16 %0
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align32_int16_t_uint16_t() {
; CHECK-LABEL: ld_cst_align32_int16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lha r3, -27108(r3)
; CHECK-NEXT:    blr
entry:
  %0 = load i16, i16* inttoptr (i64 9999900 to i16*), align 4
  ret i16 %0
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align64_int16_t_uint16_t() {
; CHECK-P10-LABEL: ld_cst_align64_int16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lha r3, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_int16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lha r3, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load i16, i16* inttoptr (i64 1000000000000 to i16*), align 4096
  ret i16 %0
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_0_int16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_0_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_0_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lha r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align16_int16_t_uint32_t(i8* nocapture readonly %ptr) {
; CHECK-LE-LABEL: ld_align16_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lha r3, 8(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_align16_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lha r3, 10(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align32_int16_t_uint32_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align32_int16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    plha r3, 99999000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align32_int16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    plha r3, 99999002(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align32_int16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 1525
; CHECK-P9-LE-NEXT:    ori r4, r4, 56600
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align32_int16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, 1525
; CHECK-P9-BE-NEXT:    ori r4, r4, 56602
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align32_int16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 1525
; CHECK-P8-LE-NEXT:    ori r4, r4, 56600
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align32_int16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, 1525
; CHECK-P8-BE-NEXT:    ori r4, r4, 56602
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align64_int16_t_uint32_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align64_int16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhax r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align64_int16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587330
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhax r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align64_int16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align64_int16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4098
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align64_int16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align64_int16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4098
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_reg_int16_t_uint32_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LE-LABEL: ld_reg_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhax r3, r3, r4
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_reg_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    add r3, r3, r4
; CHECK-BE-NEXT:    lha r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_or_int16_t_uint32_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LE-LABEL: ld_or_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    or r3, r4, r3
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_or_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    or r3, r4, r3
; CHECK-BE-NEXT:    lha r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv1 = trunc i32 %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint16_int16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint16_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 6
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint16_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 6
; CHECK-BE-NEXT:    lha r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align16_int16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_disjoint_align16_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-LE-NEXT:    lha r3, 24(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_disjoint_align16_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-BE-NEXT:    lha r3, 26(r3)
; CHECK-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 8
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint32_int16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint32_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 34463
; CHECK-LE-NEXT:    oris r3, r3, 1
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint32_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 34463
; CHECK-BE-NEXT:    oris r3, r3, 1
; CHECK-BE-NEXT:    lha r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align32_int16_t_uint32_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align32_int16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    lis r4, -15264
; CHECK-P10-LE-NEXT:    and r3, r3, r4
; CHECK-P10-LE-NEXT:    plha r3, 999990000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align32_int16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    lis r4, -15264
; CHECK-P10-BE-NEXT:    and r3, r3, r4
; CHECK-P10-BE-NEXT:    plha r3, 999990002(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align32_int16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, -15264
; CHECK-P9-LE-NEXT:    and r3, r3, r4
; CHECK-P9-LE-NEXT:    lis r4, 15258
; CHECK-P9-LE-NEXT:    ori r4, r4, 41712
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align32_int16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, -15264
; CHECK-P9-BE-NEXT:    and r3, r3, r4
; CHECK-P9-BE-NEXT:    lis r4, 15258
; CHECK-P9-BE-NEXT:    ori r4, r4, 41714
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align32_int16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, -15264
; CHECK-P8-LE-NEXT:    lis r5, 15258
; CHECK-P8-LE-NEXT:    and r3, r3, r4
; CHECK-P8-LE-NEXT:    ori r4, r5, 41712
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align32_int16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, -15264
; CHECK-P8-BE-NEXT:    lis r5, 15258
; CHECK-P8-BE-NEXT:    and r3, r3, r4
; CHECK-P8-BE-NEXT:    ori r4, r5, 41714
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 16
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint64_int16_t_uint32_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_not_disjoint64_int16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 232
; CHECK-P10-LE-NEXT:    pli r5, 3567587329
; CHECK-P10-LE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-LE-NEXT:    or r3, r3, r5
; CHECK-P10-LE-NEXT:    lha r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_not_disjoint64_int16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587329
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    or r3, r3, r5
; CHECK-P10-BE-NEXT:    lha r3, 2(r3)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_not_disjoint64_int16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    li r4, 29
; CHECK-P9-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-LE-NEXT:    oris r4, r4, 54437
; CHECK-P9-LE-NEXT:    ori r4, r4, 4097
; CHECK-P9-LE-NEXT:    or r3, r3, r4
; CHECK-P9-LE-NEXT:    lha r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_not_disjoint64_int16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4097
; CHECK-P9-BE-NEXT:    or r3, r3, r4
; CHECK-P9-BE-NEXT:    lha r3, 2(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_not_disjoint64_int16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    li r4, 29
; CHECK-P8-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-LE-NEXT:    oris r4, r4, 54437
; CHECK-P8-LE-NEXT:    ori r4, r4, 4097
; CHECK-P8-LE-NEXT:    or r3, r3, r4
; CHECK-P8-LE-NEXT:    lha r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_not_disjoint64_int16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4097
; CHECK-P8-BE-NEXT:    or r3, r3, r4
; CHECK-P8-BE-NEXT:    lha r3, 2(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align64_int16_t_uint32_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align64_int16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhax r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align64_int16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587330
; CHECK-P10-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhax r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align64_int16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align64_int16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4098
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align64_int16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align64_int16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4098
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4096
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align16_int16_t_uint32_t() {
; CHECK-LE-LABEL: ld_cst_align16_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lha r3, 4080(0)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align16_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lha r3, 4082(0)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i32, i32* inttoptr (i64 4080 to i32*), align 16
  %conv = trunc i32 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align32_int16_t_uint32_t() {
; CHECK-LE-LABEL: ld_cst_align32_int16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lis r3, 153
; CHECK-LE-NEXT:    lha r3, -27108(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align32_int16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lis r3, 153
; CHECK-BE-NEXT:    lha r3, -27106(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i32, i32* inttoptr (i64 9999900 to i32*), align 4
  %conv = trunc i32 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align64_int16_t_uint32_t() {
; CHECK-P10-LE-LABEL: ld_cst_align64_int16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r3, 244140625
; CHECK-P10-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-LE-NEXT:    lha r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_cst_align64_int16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r3, 232
; CHECK-P10-BE-NEXT:    pli r4, 3567587330
; CHECK-P10-BE-NEXT:    rldimi r4, r3, 32, 0
; CHECK-P10-BE-NEXT:    lha r3, 0(r4)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_cst_align64_int16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r3, 3725
; CHECK-P9-LE-NEXT:    ori r3, r3, 19025
; CHECK-P9-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-LE-NEXT:    lha r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_cst_align64_int16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r3, 29
; CHECK-P9-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P9-BE-NEXT:    oris r3, r3, 54437
; CHECK-P9-BE-NEXT:    ori r3, r3, 4098
; CHECK-P9-BE-NEXT:    lha r3, 0(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_cst_align64_int16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r3, 3725
; CHECK-P8-LE-NEXT:    ori r3, r3, 19025
; CHECK-P8-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-LE-NEXT:    lha r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_cst_align64_int16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r3, 29
; CHECK-P8-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P8-BE-NEXT:    oris r3, r3, 54437
; CHECK-P8-BE-NEXT:    ori r3, r3, 4098
; CHECK-P8-BE-NEXT:    lha r3, 0(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %0 = load i32, i32* inttoptr (i64 1000000000000 to i32*), align 4096
  %conv = trunc i32 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_0_int16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_0_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_0_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lha r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align16_int16_t_uint64_t(i8* nocapture readonly %ptr) {
; CHECK-LE-LABEL: ld_align16_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lha r3, 8(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_align16_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lha r3, 14(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align32_int16_t_uint64_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align32_int16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    plha r3, 99999000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align32_int16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    plha r3, 99999006(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align32_int16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 1525
; CHECK-P9-LE-NEXT:    ori r4, r4, 56600
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align32_int16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, 1525
; CHECK-P9-BE-NEXT:    ori r4, r4, 56606
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align32_int16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 1525
; CHECK-P8-LE-NEXT:    ori r4, r4, 56600
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align32_int16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, 1525
; CHECK-P8-BE-NEXT:    ori r4, r4, 56606
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align64_int16_t_uint64_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align64_int16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhax r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align64_int16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587334
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhax r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align64_int16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align64_int16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4102
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align64_int16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align64_int16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4102
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_reg_int16_t_uint64_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LE-LABEL: ld_reg_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhax r3, r3, r4
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_reg_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    add r3, r3, r4
; CHECK-BE-NEXT:    lha r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_or_int16_t_uint64_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LE-LABEL: ld_or_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    or r3, r4, r3
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_or_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    or r3, r4, r3
; CHECK-BE-NEXT:    lha r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv1 = trunc i64 %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint16_int16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint16_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 6
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint16_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 6
; CHECK-BE-NEXT:    lha r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align16_int16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_disjoint_align16_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-LE-NEXT:    lha r3, 24(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_disjoint_align16_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-BE-NEXT:    lha r3, 30(r3)
; CHECK-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint32_int16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint32_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 34463
; CHECK-LE-NEXT:    oris r3, r3, 1
; CHECK-LE-NEXT:    lha r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint32_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 34463
; CHECK-BE-NEXT:    oris r3, r3, 1
; CHECK-BE-NEXT:    lha r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align32_int16_t_uint64_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align32_int16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    lis r4, -15264
; CHECK-P10-LE-NEXT:    and r3, r3, r4
; CHECK-P10-LE-NEXT:    plha r3, 999990000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align32_int16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    lis r4, -15264
; CHECK-P10-BE-NEXT:    and r3, r3, r4
; CHECK-P10-BE-NEXT:    plha r3, 999990006(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align32_int16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, -15264
; CHECK-P9-LE-NEXT:    and r3, r3, r4
; CHECK-P9-LE-NEXT:    lis r4, 15258
; CHECK-P9-LE-NEXT:    ori r4, r4, 41712
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align32_int16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, -15264
; CHECK-P9-BE-NEXT:    and r3, r3, r4
; CHECK-P9-BE-NEXT:    lis r4, 15258
; CHECK-P9-BE-NEXT:    ori r4, r4, 41718
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align32_int16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, -15264
; CHECK-P8-LE-NEXT:    lis r5, 15258
; CHECK-P8-LE-NEXT:    and r3, r3, r4
; CHECK-P8-LE-NEXT:    ori r4, r5, 41712
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align32_int16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, -15264
; CHECK-P8-BE-NEXT:    lis r5, 15258
; CHECK-P8-BE-NEXT:    and r3, r3, r4
; CHECK-P8-BE-NEXT:    ori r4, r5, 41718
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 16
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint64_int16_t_uint64_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_not_disjoint64_int16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 232
; CHECK-P10-LE-NEXT:    pli r5, 3567587329
; CHECK-P10-LE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-LE-NEXT:    or r3, r3, r5
; CHECK-P10-LE-NEXT:    lha r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_not_disjoint64_int16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587329
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    or r3, r3, r5
; CHECK-P10-BE-NEXT:    lha r3, 6(r3)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_not_disjoint64_int16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    li r4, 29
; CHECK-P9-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-LE-NEXT:    oris r4, r4, 54437
; CHECK-P9-LE-NEXT:    ori r4, r4, 4097
; CHECK-P9-LE-NEXT:    or r3, r3, r4
; CHECK-P9-LE-NEXT:    lha r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_not_disjoint64_int16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4097
; CHECK-P9-BE-NEXT:    or r3, r3, r4
; CHECK-P9-BE-NEXT:    lha r3, 6(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_not_disjoint64_int16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    li r4, 29
; CHECK-P8-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-LE-NEXT:    oris r4, r4, 54437
; CHECK-P8-LE-NEXT:    ori r4, r4, 4097
; CHECK-P8-LE-NEXT:    or r3, r3, r4
; CHECK-P8-LE-NEXT:    lha r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_not_disjoint64_int16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4097
; CHECK-P8-BE-NEXT:    or r3, r3, r4
; CHECK-P8-BE-NEXT:    lha r3, 6(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align64_int16_t_uint64_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align64_int16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhax r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align64_int16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587334
; CHECK-P10-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhax r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align64_int16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhax r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align64_int16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4102
; CHECK-P9-BE-NEXT:    lhax r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align64_int16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhax r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align64_int16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4102
; CHECK-P8-BE-NEXT:    lhax r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 4096
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align16_int16_t_uint64_t() {
; CHECK-LE-LABEL: ld_cst_align16_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lha r3, 4080(0)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align16_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lha r3, 4086(0)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i64, i64* inttoptr (i64 4080 to i64*), align 16
  %conv = trunc i64 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align32_int16_t_uint64_t() {
; CHECK-LE-LABEL: ld_cst_align32_int16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lis r3, 153
; CHECK-LE-NEXT:    lha r3, -27108(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align32_int16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lis r3, 153
; CHECK-BE-NEXT:    lha r3, -27102(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i64, i64* inttoptr (i64 9999900 to i64*), align 8
  %conv = trunc i64 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align64_int16_t_uint64_t() {
; CHECK-P10-LE-LABEL: ld_cst_align64_int16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r3, 244140625
; CHECK-P10-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-LE-NEXT:    lha r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_cst_align64_int16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r3, 232
; CHECK-P10-BE-NEXT:    pli r4, 3567587334
; CHECK-P10-BE-NEXT:    rldimi r4, r3, 32, 0
; CHECK-P10-BE-NEXT:    lha r3, 0(r4)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_cst_align64_int16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r3, 3725
; CHECK-P9-LE-NEXT:    ori r3, r3, 19025
; CHECK-P9-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-LE-NEXT:    lha r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_cst_align64_int16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r3, 29
; CHECK-P9-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P9-BE-NEXT:    oris r3, r3, 54437
; CHECK-P9-BE-NEXT:    ori r3, r3, 4102
; CHECK-P9-BE-NEXT:    lha r3, 0(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_cst_align64_int16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r3, 3725
; CHECK-P8-LE-NEXT:    ori r3, r3, 19025
; CHECK-P8-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-LE-NEXT:    lha r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_cst_align64_int16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r3, 29
; CHECK-P8-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P8-BE-NEXT:    oris r3, r3, 54437
; CHECK-P8-BE-NEXT:    ori r3, r3, 4102
; CHECK-P8-BE-NEXT:    lha r3, 0(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %0 = load i64, i64* inttoptr (i64 1000000000000 to i64*), align 4096
  %conv = trunc i64 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_0_int16_t_float(i64 %ptr) {
; CHECK-LABEL: ld_0_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfs f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align16_int16_t_float(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfs f0, 8(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align32_int16_t_float(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plfs f0, 99999000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_int16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lfsx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align64_int16_t_float(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfsx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_int16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfsx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_reg_int16_t_float(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfsx f0, r3, r4
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_or_int16_t_float(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lfs f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv1 = fptosi float %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint16_int16_t_float(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lfs f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align16_int16_t_float(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lfs f0, 24(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 8
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint32_int16_t_float(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lfs f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align32_int16_t_float(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plfs f0, 999990000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_int16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lfsx f0, r3, r4
; CHECK-P9-NEXT:    xscvdpsxws f0, f0
; CHECK-P9-NEXT:    mffprwz r3, f0
; CHECK-P9-NEXT:    extsw r3, r3
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_int16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lfsx f0, r3, r4
; CHECK-P8-NEXT:    xscvdpsxws f0, f0
; CHECK-P8-NEXT:    mffprwz r3, f0
; CHECK-P8-NEXT:    extsw r3, r3
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 16
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint64_int16_t_float(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lfs f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_int16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lfs f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv = fptosi float %1 to i16
  ret i16 %conv
}


; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align64_int16_t_float(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfsx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_int16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfsx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4096
  %conv = fptosi float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align16_int16_t_float() {
; CHECK-LABEL: ld_cst_align16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfs f0, 4080(0)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = load float, float* inttoptr (i64 4080 to float*), align 16
  %conv = fptosi float %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align32_int16_t_float() {
; CHECK-LABEL: ld_cst_align32_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lfs f0, -27108(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = load float, float* inttoptr (i64 9999900 to float*), align 4
  %conv = fptosi float %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align64_int16_t_float() {
; CHECK-P10-LABEL: ld_cst_align64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lfs f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_int16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lfs f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load float, float* inttoptr (i64 1000000000000 to float*), align 4096
  %conv = fptosi float %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_0_int16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_0_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align16_int16_t_double(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfd f0, 8(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align32_int16_t_double(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plfd f0, 99999000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_int16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lfdx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_align64_int16_t_double(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfdx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_int16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfdx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_reg_int16_t_double(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfdx f0, r3, r4
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_or_int16_t_double(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv1 = fptosi double %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint16_int16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align16_int16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lfd f0, 24(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint32_int16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align32_int16_t_double(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plfd f0, 999990000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_int16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lfdx f0, r3, r4
; CHECK-P9-NEXT:    xscvdpsxws f0, f0
; CHECK-P9-NEXT:    mffprwz r3, f0
; CHECK-P9-NEXT:    extsw r3, r3
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_int16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lfdx f0, r3, r4
; CHECK-P8-NEXT:    xscvdpsxws f0, f0
; CHECK-P8-NEXT:    mffprwz r3, f0
; CHECK-P8-NEXT:    extsw r3, r3
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 16
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_not_disjoint64_int16_t_double(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lfd f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_int16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lfd f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_disjoint_align64_int16_t_double(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfdx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_int16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfdx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 4096
  %conv = fptosi double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align16_int16_t_double() {
; CHECK-LABEL: ld_cst_align16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfd f0, 4080(0)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = load double, double* inttoptr (i64 4080 to double*), align 16
  %conv = fptosi double %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align32_int16_t_double() {
; CHECK-LABEL: ld_cst_align32_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lfd f0, -27108(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    extsw r3, r3
; CHECK-NEXT:    blr
entry:
  %0 = load double, double* inttoptr (i64 9999900 to double*), align 8
  %conv = fptosi double %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local signext i16 @ld_cst_align64_int16_t_double() {
; CHECK-P10-LABEL: ld_cst_align64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lfd f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    extsw r3, r3
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_int16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lfd f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    extsw r3, r3
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load double, double* inttoptr (i64 1000000000000 to double*), align 4096
  %conv = fptosi double %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_0_uint16_t_uint8_t(i64 %ptr) {
; CHECK-LABEL: ld_0_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i8*
  %1 = load i8, i8* %0, align 1
  %conv = zext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align16_uint16_t_uint8_t(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 8(r3)
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = load i8, i8* %add.ptr, align 1
  %conv = zext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align32_uint16_t_uint8_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plbz r3, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = load i8, i8* %add.ptr, align 1
  %conv = zext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align64_uint16_t_uint8_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lbzx r3, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = load i8, i8* %add.ptr, align 1
  %conv = zext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_reg_uint16_t_uint8_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbzx r3, r3, r4
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = load i8, i8* %add.ptr, align 1
  %conv = zext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_or_uint16_t_uint8_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv1 = zext i8 %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint16_uint16_t_uint8_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = zext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align16_uint16_t_uint8_t(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lbz r3, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 8
  %conv = zext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint32_uint16_t_uint8_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = zext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align32_uint16_t_uint8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plbz r3, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_uint16_t_uint8_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lbzx r3, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_uint16_t_uint8_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lbzx r3, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 16
  %conv = zext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint64_uint16_t_uint8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lbz r3, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lbz r3, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = zext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align64_uint16_t_uint8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lbzx r3, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 4096
  %conv = zext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align16_uint16_t_uint8_t() {
; CHECK-LABEL: ld_cst_align16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 4080 to i8*), align 16
  %conv = zext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align32_uint16_t_uint8_t() {
; CHECK-LABEL: ld_cst_align32_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lbz r3, -27108(r3)
; CHECK-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 9999900 to i8*), align 4
  %conv = zext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align64_uint16_t_uint8_t() {
; CHECK-P10-LABEL: ld_cst_align64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lbz r3, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lbz r3, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 1000000000000 to i8*), align 4096
  %conv = zext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_0_uint16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_0_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align16_uint16_t_int8_t(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 8(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align32_uint16_t_int8_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_uint16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plbz r3, 99999000(r3), 0
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    clrldi r3, r3, 48
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_uint16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    clrldi r3, r3, 48
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align64_uint16_t_int8_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_uint16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lbzx r3, r3, r4
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    clrldi r3, r3, 48
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_uint16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    clrldi r3, r3, 48
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_reg_uint16_t_int8_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbzx r3, r3, r4
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = load i8, i8* %add.ptr, align 1
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_or_uint16_t_int8_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv1 = sext i8 %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint16_uint16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align16_uint16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lbz r3, 24(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 8
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint32_uint16_t_int8_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lbz r3, 0(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align32_uint16_t_int8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_uint16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plbz r3, 999990000(r3), 0
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    clrldi r3, r3, 48
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_uint16_t_int8_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lbzx r3, r3, r4
; CHECK-P9-NEXT:    extsb r3, r3
; CHECK-P9-NEXT:    clrldi r3, r3, 48
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_uint16_t_int8_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lbzx r3, r3, r4
; CHECK-P8-NEXT:    extsb r3, r3
; CHECK-P8-NEXT:    clrldi r3, r3, 48
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 16
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint64_uint16_t_int8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_uint16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lbz r3, 0(r3)
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    clrldi r3, r3, 48
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_uint16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lbz r3, 0(r3)
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    clrldi r3, r3, 48
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 1
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align64_uint16_t_int8_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_uint16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lbzx r3, r3, r4
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    clrldi r3, r3, 48
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_uint16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lbzx r3, r3, r4
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    clrldi r3, r3, 48
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i8*
  %1 = load i8, i8* %0, align 4096
  %conv = sext i8 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align16_uint16_t_int8_t() {
; CHECK-LABEL: ld_cst_align16_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lbz r3, 4080(0)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 4080 to i8*), align 16
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align32_uint16_t_int8_t() {
; CHECK-LABEL: ld_cst_align32_uint16_t_int8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lbz r3, -27108(r3)
; CHECK-NEXT:    extsb r3, r3
; CHECK-NEXT:    clrldi r3, r3, 48
; CHECK-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 9999900 to i8*), align 4
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align64_uint16_t_int8_t() {
; CHECK-P10-LABEL: ld_cst_align64_uint16_t_int8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lbz r3, 0(r3)
; CHECK-P10-NEXT:    extsb r3, r3
; CHECK-P10-NEXT:    clrldi r3, r3, 48
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_uint16_t_int8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lbz r3, 0(r3)
; CHECK-PREP10-NEXT:    extsb r3, r3
; CHECK-PREP10-NEXT:    clrldi r3, r3, 48
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load i8, i8* inttoptr (i64 1000000000000 to i8*), align 4096
  %conv = sext i8 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_0_uint16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_0_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lhz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align16_uint16_t_uint16_t(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lhz r3, 8(r3)
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align32_uint16_t_uint16_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plhz r3, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lhzx r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align64_uint16_t_uint16_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lhzx r3, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lhzx r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_reg_uint16_t_uint16_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lhzx r3, r3, r4
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_or_uint16_t_uint16_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lhz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint16_uint16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lhz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align16_uint16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lhz r3, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 8
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint32_uint16_t_uint16_t(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lhz r3, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align32_uint16_t_uint16_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plhz r3, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_uint16_t_uint16_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lhzx r3, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_uint16_t_uint16_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lhzx r3, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 16
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint64_uint16_t_uint16_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lhz r3, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lhz r3, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 2
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align64_uint16_t_uint16_t(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lhzx r3, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lhzx r3, r3, r4
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i16*
  %1 = load i16, i16* %0, align 4096
  ret i16 %1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align16_uint16_t_uint16_t() {
; CHECK-LABEL: ld_cst_align16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lhz r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %0 = load i16, i16* inttoptr (i64 4080 to i16*), align 16
  ret i16 %0
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align32_uint16_t_uint16_t() {
; CHECK-LABEL: ld_cst_align32_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lhz r3, -27108(r3)
; CHECK-NEXT:    blr
entry:
  %0 = load i16, i16* inttoptr (i64 9999900 to i16*), align 4
  ret i16 %0
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align64_uint16_t_uint16_t() {
; CHECK-P10-LABEL: ld_cst_align64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lhz r3, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lhz r3, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load i16, i16* inttoptr (i64 1000000000000 to i16*), align 4096
  ret i16 %0
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_0_uint16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_0_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_0_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lhz r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align16_uint16_t_uint32_t(i8* nocapture readonly %ptr) {
; CHECK-LE-LABEL: ld_align16_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhz r3, 8(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_align16_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lhz r3, 10(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align32_uint16_t_uint32_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align32_uint16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    plhz r3, 99999000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align32_uint16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    plhz r3, 99999002(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align32_uint16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 1525
; CHECK-P9-LE-NEXT:    ori r4, r4, 56600
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align32_uint16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, 1525
; CHECK-P9-BE-NEXT:    ori r4, r4, 56602
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align32_uint16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 1525
; CHECK-P8-LE-NEXT:    ori r4, r4, 56600
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align32_uint16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, 1525
; CHECK-P8-BE-NEXT:    ori r4, r4, 56602
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align64_uint16_t_uint32_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align64_uint16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align64_uint16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587330
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhzx r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align64_uint16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align64_uint16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4098
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align64_uint16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align64_uint16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4098
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_reg_uint16_t_uint32_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LE-LABEL: ld_reg_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhzx r3, r3, r4
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_reg_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    add r3, r3, r4
; CHECK-BE-NEXT:    lhz r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_or_uint16_t_uint32_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LE-LABEL: ld_or_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    or r3, r4, r3
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_or_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    or r3, r4, r3
; CHECK-BE-NEXT:    lhz r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv1 = trunc i32 %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint16_uint16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint16_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 6
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint16_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 6
; CHECK-BE-NEXT:    lhz r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align16_uint16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_disjoint_align16_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-LE-NEXT:    lhz r3, 24(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_disjoint_align16_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-BE-NEXT:    lhz r3, 26(r3)
; CHECK-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 8
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint32_uint16_t_uint32_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint32_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 34463
; CHECK-LE-NEXT:    oris r3, r3, 1
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint32_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 34463
; CHECK-BE-NEXT:    oris r3, r3, 1
; CHECK-BE-NEXT:    lhz r3, 2(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align32_uint16_t_uint32_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align32_uint16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    lis r4, -15264
; CHECK-P10-LE-NEXT:    and r3, r3, r4
; CHECK-P10-LE-NEXT:    plhz r3, 999990000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align32_uint16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    lis r4, -15264
; CHECK-P10-BE-NEXT:    and r3, r3, r4
; CHECK-P10-BE-NEXT:    plhz r3, 999990002(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align32_uint16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, -15264
; CHECK-P9-LE-NEXT:    and r3, r3, r4
; CHECK-P9-LE-NEXT:    lis r4, 15258
; CHECK-P9-LE-NEXT:    ori r4, r4, 41712
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align32_uint16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, -15264
; CHECK-P9-BE-NEXT:    and r3, r3, r4
; CHECK-P9-BE-NEXT:    lis r4, 15258
; CHECK-P9-BE-NEXT:    ori r4, r4, 41714
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align32_uint16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, -15264
; CHECK-P8-LE-NEXT:    lis r5, 15258
; CHECK-P8-LE-NEXT:    and r3, r3, r4
; CHECK-P8-LE-NEXT:    ori r4, r5, 41712
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align32_uint16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, -15264
; CHECK-P8-BE-NEXT:    lis r5, 15258
; CHECK-P8-BE-NEXT:    and r3, r3, r4
; CHECK-P8-BE-NEXT:    ori r4, r5, 41714
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 16
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint64_uint16_t_uint32_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_not_disjoint64_uint16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 232
; CHECK-P10-LE-NEXT:    pli r5, 3567587329
; CHECK-P10-LE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-LE-NEXT:    or r3, r3, r5
; CHECK-P10-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_not_disjoint64_uint16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587329
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    or r3, r3, r5
; CHECK-P10-BE-NEXT:    lhz r3, 2(r3)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_not_disjoint64_uint16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    li r4, 29
; CHECK-P9-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-LE-NEXT:    oris r4, r4, 54437
; CHECK-P9-LE-NEXT:    ori r4, r4, 4097
; CHECK-P9-LE-NEXT:    or r3, r3, r4
; CHECK-P9-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_not_disjoint64_uint16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4097
; CHECK-P9-BE-NEXT:    or r3, r3, r4
; CHECK-P9-BE-NEXT:    lhz r3, 2(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_not_disjoint64_uint16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    li r4, 29
; CHECK-P8-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-LE-NEXT:    oris r4, r4, 54437
; CHECK-P8-LE-NEXT:    ori r4, r4, 4097
; CHECK-P8-LE-NEXT:    or r3, r3, r4
; CHECK-P8-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_not_disjoint64_uint16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4097
; CHECK-P8-BE-NEXT:    or r3, r3, r4
; CHECK-P8-BE-NEXT:    lhz r3, 2(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align64_uint16_t_uint32_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align64_uint16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align64_uint16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587330
; CHECK-P10-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhzx r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align64_uint16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align64_uint16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4098
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align64_uint16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align64_uint16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4098
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i32*
  %1 = load i32, i32* %0, align 4096
  %conv = trunc i32 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align16_uint16_t_uint32_t() {
; CHECK-LE-LABEL: ld_cst_align16_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhz r3, 4080(0)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align16_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lhz r3, 4082(0)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i32, i32* inttoptr (i64 4080 to i32*), align 16
  %conv = trunc i32 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align32_uint16_t_uint32_t() {
; CHECK-LE-LABEL: ld_cst_align32_uint16_t_uint32_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lis r3, 153
; CHECK-LE-NEXT:    lhz r3, -27108(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align32_uint16_t_uint32_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lis r3, 153
; CHECK-BE-NEXT:    lhz r3, -27106(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i32, i32* inttoptr (i64 9999900 to i32*), align 4
  %conv = trunc i32 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align64_uint16_t_uint32_t() {
; CHECK-P10-LE-LABEL: ld_cst_align64_uint16_t_uint32_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r3, 244140625
; CHECK-P10-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_cst_align64_uint16_t_uint32_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r3, 232
; CHECK-P10-BE-NEXT:    pli r4, 3567587330
; CHECK-P10-BE-NEXT:    rldimi r4, r3, 32, 0
; CHECK-P10-BE-NEXT:    lhz r3, 0(r4)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_cst_align64_uint16_t_uint32_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r3, 3725
; CHECK-P9-LE-NEXT:    ori r3, r3, 19025
; CHECK-P9-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_cst_align64_uint16_t_uint32_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r3, 29
; CHECK-P9-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P9-BE-NEXT:    oris r3, r3, 54437
; CHECK-P9-BE-NEXT:    ori r3, r3, 4098
; CHECK-P9-BE-NEXT:    lhz r3, 0(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_cst_align64_uint16_t_uint32_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r3, 3725
; CHECK-P8-LE-NEXT:    ori r3, r3, 19025
; CHECK-P8-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_cst_align64_uint16_t_uint32_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r3, 29
; CHECK-P8-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P8-BE-NEXT:    oris r3, r3, 54437
; CHECK-P8-BE-NEXT:    ori r3, r3, 4098
; CHECK-P8-BE-NEXT:    lhz r3, 0(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %0 = load i32, i32* inttoptr (i64 1000000000000 to i32*), align 4096
  %conv = trunc i32 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_0_uint16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_0_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_0_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lhz r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align16_uint16_t_uint64_t(i8* nocapture readonly %ptr) {
; CHECK-LE-LABEL: ld_align16_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhz r3, 8(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_align16_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lhz r3, 14(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align32_uint16_t_uint64_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align32_uint16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    plhz r3, 99999000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align32_uint16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    plhz r3, 99999006(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align32_uint16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 1525
; CHECK-P9-LE-NEXT:    ori r4, r4, 56600
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align32_uint16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, 1525
; CHECK-P9-BE-NEXT:    ori r4, r4, 56606
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align32_uint16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 1525
; CHECK-P8-LE-NEXT:    ori r4, r4, 56600
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align32_uint16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, 1525
; CHECK-P8-BE-NEXT:    ori r4, r4, 56606
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align64_uint16_t_uint64_t(i8* nocapture readonly %ptr) {
; CHECK-P10-LE-LABEL: ld_align64_uint16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_align64_uint16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587334
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhzx r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_align64_uint16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_align64_uint16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4102
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_align64_uint16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_align64_uint16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4102
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_reg_uint16_t_uint64_t(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LE-LABEL: ld_reg_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhzx r3, r3, r4
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_reg_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    add r3, r3, r4
; CHECK-BE-NEXT:    lhz r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_or_uint16_t_uint64_t(i64 %ptr, i8 zeroext %off) {
; CHECK-LE-LABEL: ld_or_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    or r3, r4, r3
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_or_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    or r3, r4, r3
; CHECK-BE-NEXT:    lhz r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv1 = trunc i64 %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint16_uint16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint16_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 6
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint16_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 6
; CHECK-BE-NEXT:    lhz r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align16_uint16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_disjoint_align16_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-LE-NEXT:    lhz r3, 24(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_disjoint_align16_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    rldicr r3, r3, 0, 51
; CHECK-BE-NEXT:    lhz r3, 30(r3)
; CHECK-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint32_uint16_t_uint64_t(i64 %ptr) {
; CHECK-LE-LABEL: ld_not_disjoint32_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    ori r3, r3, 34463
; CHECK-LE-NEXT:    oris r3, r3, 1
; CHECK-LE-NEXT:    lhz r3, 0(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_not_disjoint32_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    ori r3, r3, 34463
; CHECK-BE-NEXT:    oris r3, r3, 1
; CHECK-BE-NEXT:    lhz r3, 6(r3)
; CHECK-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align32_uint16_t_uint64_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align32_uint16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    lis r4, -15264
; CHECK-P10-LE-NEXT:    and r3, r3, r4
; CHECK-P10-LE-NEXT:    plhz r3, 999990000(r3), 0
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align32_uint16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    lis r4, -15264
; CHECK-P10-BE-NEXT:    and r3, r3, r4
; CHECK-P10-BE-NEXT:    plhz r3, 999990006(r3), 0
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align32_uint16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, -15264
; CHECK-P9-LE-NEXT:    and r3, r3, r4
; CHECK-P9-LE-NEXT:    lis r4, 15258
; CHECK-P9-LE-NEXT:    ori r4, r4, 41712
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align32_uint16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    lis r4, -15264
; CHECK-P9-BE-NEXT:    and r3, r3, r4
; CHECK-P9-BE-NEXT:    lis r4, 15258
; CHECK-P9-BE-NEXT:    ori r4, r4, 41718
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align32_uint16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, -15264
; CHECK-P8-LE-NEXT:    lis r5, 15258
; CHECK-P8-LE-NEXT:    and r3, r3, r4
; CHECK-P8-LE-NEXT:    ori r4, r5, 41712
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align32_uint16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    lis r4, -15264
; CHECK-P8-BE-NEXT:    lis r5, 15258
; CHECK-P8-BE-NEXT:    and r3, r3, r4
; CHECK-P8-BE-NEXT:    ori r4, r5, 41718
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 16
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint64_uint16_t_uint64_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_not_disjoint64_uint16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 232
; CHECK-P10-LE-NEXT:    pli r5, 3567587329
; CHECK-P10-LE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-LE-NEXT:    or r3, r3, r5
; CHECK-P10-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_not_disjoint64_uint16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587329
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    or r3, r3, r5
; CHECK-P10-BE-NEXT:    lhz r3, 6(r3)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_not_disjoint64_uint16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    li r4, 29
; CHECK-P9-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-LE-NEXT:    oris r4, r4, 54437
; CHECK-P9-LE-NEXT:    ori r4, r4, 4097
; CHECK-P9-LE-NEXT:    or r3, r3, r4
; CHECK-P9-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_not_disjoint64_uint16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4097
; CHECK-P9-BE-NEXT:    or r3, r3, r4
; CHECK-P9-BE-NEXT:    lhz r3, 6(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_not_disjoint64_uint16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    li r4, 29
; CHECK-P8-LE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-LE-NEXT:    oris r4, r4, 54437
; CHECK-P8-LE-NEXT:    ori r4, r4, 4097
; CHECK-P8-LE-NEXT:    or r3, r3, r4
; CHECK-P8-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_not_disjoint64_uint16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4097
; CHECK-P8-BE-NEXT:    or r3, r3, r4
; CHECK-P8-BE-NEXT:    lhz r3, 6(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 8
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align64_uint16_t_uint64_t(i64 %ptr) {
; CHECK-P10-LE-LABEL: ld_disjoint_align64_uint16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r4, 244140625
; CHECK-P10-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_disjoint_align64_uint16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r4, 232
; CHECK-P10-BE-NEXT:    pli r5, 3567587334
; CHECK-P10-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-BE-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-BE-NEXT:    lhzx r3, r3, r5
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_disjoint_align64_uint16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r4, 3725
; CHECK-P9-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-LE-NEXT:    ori r4, r4, 19025
; CHECK-P9-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_disjoint_align64_uint16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r4, 29
; CHECK-P9-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P9-BE-NEXT:    oris r4, r4, 54437
; CHECK-P9-BE-NEXT:    ori r4, r4, 4102
; CHECK-P9-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_disjoint_align64_uint16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r4, 3725
; CHECK-P8-LE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-LE-NEXT:    ori r4, r4, 19025
; CHECK-P8-LE-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-LE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_disjoint_align64_uint16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r4, 29
; CHECK-P8-BE-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-BE-NEXT:    rldic r4, r4, 35, 24
; CHECK-P8-BE-NEXT:    oris r4, r4, 54437
; CHECK-P8-BE-NEXT:    ori r4, r4, 4102
; CHECK-P8-BE-NEXT:    lhzx r3, r3, r4
; CHECK-P8-BE-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i64*
  %1 = load i64, i64* %0, align 4096
  %conv = trunc i64 %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align16_uint16_t_uint64_t() {
; CHECK-LE-LABEL: ld_cst_align16_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lhz r3, 4080(0)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align16_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lhz r3, 4086(0)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i64, i64* inttoptr (i64 4080 to i64*), align 16
  %conv = trunc i64 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align32_uint16_t_uint64_t() {
; CHECK-LE-LABEL: ld_cst_align32_uint16_t_uint64_t:
; CHECK-LE:       # %bb.0: # %entry
; CHECK-LE-NEXT:    lis r3, 153
; CHECK-LE-NEXT:    lhz r3, -27108(r3)
; CHECK-LE-NEXT:    blr
;
; CHECK-BE-LABEL: ld_cst_align32_uint16_t_uint64_t:
; CHECK-BE:       # %bb.0: # %entry
; CHECK-BE-NEXT:    lis r3, 153
; CHECK-BE-NEXT:    lhz r3, -27102(r3)
; CHECK-BE-NEXT:    blr
entry:
  %0 = load i64, i64* inttoptr (i64 9999900 to i64*), align 8
  %conv = trunc i64 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align64_uint16_t_uint64_t() {
; CHECK-P10-LE-LABEL: ld_cst_align64_uint16_t_uint64_t:
; CHECK-P10-LE:       # %bb.0: # %entry
; CHECK-P10-LE-NEXT:    pli r3, 244140625
; CHECK-P10-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P10-LE-NEXT:    blr
;
; CHECK-P10-BE-LABEL: ld_cst_align64_uint16_t_uint64_t:
; CHECK-P10-BE:       # %bb.0: # %entry
; CHECK-P10-BE-NEXT:    pli r3, 232
; CHECK-P10-BE-NEXT:    pli r4, 3567587334
; CHECK-P10-BE-NEXT:    rldimi r4, r3, 32, 0
; CHECK-P10-BE-NEXT:    lhz r3, 0(r4)
; CHECK-P10-BE-NEXT:    blr
;
; CHECK-P9-LE-LABEL: ld_cst_align64_uint16_t_uint64_t:
; CHECK-P9-LE:       # %bb.0: # %entry
; CHECK-P9-LE-NEXT:    lis r3, 3725
; CHECK-P9-LE-NEXT:    ori r3, r3, 19025
; CHECK-P9-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P9-LE-NEXT:    blr
;
; CHECK-P9-BE-LABEL: ld_cst_align64_uint16_t_uint64_t:
; CHECK-P9-BE:       # %bb.0: # %entry
; CHECK-P9-BE-NEXT:    li r3, 29
; CHECK-P9-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P9-BE-NEXT:    oris r3, r3, 54437
; CHECK-P9-BE-NEXT:    ori r3, r3, 4102
; CHECK-P9-BE-NEXT:    lhz r3, 0(r3)
; CHECK-P9-BE-NEXT:    blr
;
; CHECK-P8-LE-LABEL: ld_cst_align64_uint16_t_uint64_t:
; CHECK-P8-LE:       # %bb.0: # %entry
; CHECK-P8-LE-NEXT:    lis r3, 3725
; CHECK-P8-LE-NEXT:    ori r3, r3, 19025
; CHECK-P8-LE-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-LE-NEXT:    lhz r3, 0(r3)
; CHECK-P8-LE-NEXT:    blr
;
; CHECK-P8-BE-LABEL: ld_cst_align64_uint16_t_uint64_t:
; CHECK-P8-BE:       # %bb.0: # %entry
; CHECK-P8-BE-NEXT:    li r3, 29
; CHECK-P8-BE-NEXT:    rldic r3, r3, 35, 24
; CHECK-P8-BE-NEXT:    oris r3, r3, 54437
; CHECK-P8-BE-NEXT:    ori r3, r3, 4102
; CHECK-P8-BE-NEXT:    lhz r3, 0(r3)
; CHECK-P8-BE-NEXT:    blr
entry:
  %0 = load i64, i64* inttoptr (i64 1000000000000 to i64*), align 4096
  %conv = trunc i64 %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align16_uint16_t_float(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfs f0, 8(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align32_uint16_t_float(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plfs f0, 99999000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_uint16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lfsx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align64_uint16_t_float(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfsx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_uint16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfsx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_reg_uint16_t_float(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfsx f0, r3, r4
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to float*
  %1 = load float, float* %0, align 4
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_or_uint16_t_float(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lfs f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv1 = fptoui float %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint16_uint16_t_float(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lfs f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align16_uint16_t_float(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lfs f0, 24(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 8
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint32_uint16_t_float(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lfs f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align32_uint16_t_float(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plfs f0, 999990000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_uint16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lfsx f0, r3, r4
; CHECK-P9-NEXT:    xscvdpsxws f0, f0
; CHECK-P9-NEXT:    mffprwz r3, f0
; CHECK-P9-NEXT:    clrldi r3, r3, 32
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_uint16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lfsx f0, r3, r4
; CHECK-P8-NEXT:    xscvdpsxws f0, f0
; CHECK-P8-NEXT:    mffprwz r3, f0
; CHECK-P8-NEXT:    clrldi r3, r3, 32
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 16
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint64_uint16_t_float(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lfs f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_uint16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lfs f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align64_uint16_t_float(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfsx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_uint16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfsx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to float*
  %1 = load float, float* %0, align 4096
  %conv = fptoui float %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align16_uint16_t_float() {
; CHECK-LABEL: ld_cst_align16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfs f0, 4080(0)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %0 = load float, float* inttoptr (i64 4080 to float*), align 16
  %conv = fptoui float %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align32_uint16_t_float() {
; CHECK-LABEL: ld_cst_align32_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lfs f0, -27108(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %0 = load float, float* inttoptr (i64 9999900 to float*), align 4
  %conv = fptoui float %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align64_uint16_t_float() {
; CHECK-P10-LABEL: ld_cst_align64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lfs f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_uint16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lfs f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load float, float* inttoptr (i64 1000000000000 to float*), align 4096
  %conv = fptoui float %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_0_uint16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_0_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align16_uint16_t_double(i8* nocapture readonly %ptr) {
; CHECK-LABEL: ld_align16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfd f0, 8(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align32_uint16_t_double(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align32_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    plfd f0, 99999000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align32_uint16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 1525
; CHECK-PREP10-NEXT:    ori r4, r4, 56600
; CHECK-PREP10-NEXT:    lfdx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_align64_uint16_t_double(i8* nocapture readonly %ptr) {
; CHECK-P10-LABEL: ld_align64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfdx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_align64_uint16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfdx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_reg_uint16_t_double(i8* nocapture readonly %ptr, i64 %off) {
; CHECK-LABEL: ld_reg_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfdx f0, r3, r4
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_or_uint16_t_double(i64 %ptr, i8 zeroext %off) {
; CHECK-LABEL: ld_or_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv1 = fptoui double %1 to i16
  ret i16 %conv1
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint16_uint16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align16_uint16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_disjoint_align16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    lfd f0, 24(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint32_uint16_t_double(i64 %ptr) {
; CHECK-LABEL: ld_not_disjoint32_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    lfd f0, 0(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align32_uint16_t_double(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align32_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r4, -15264
; CHECK-P10-NEXT:    and r3, r3, r4
; CHECK-P10-NEXT:    plfd f0, 999990000(r3), 0
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: ld_disjoint_align32_uint16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r4, -15264
; CHECK-P9-NEXT:    and r3, r3, r4
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    lfdx f0, r3, r4
; CHECK-P9-NEXT:    xscvdpsxws f0, f0
; CHECK-P9-NEXT:    mffprwz r3, f0
; CHECK-P9-NEXT:    clrldi r3, r3, 32
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: ld_disjoint_align32_uint16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    lfdx f0, r3, r4
; CHECK-P8-NEXT:    xscvdpsxws f0, f0
; CHECK-P8-NEXT:    mffprwz r3, f0
; CHECK-P8-NEXT:    clrldi r3, r3, 32
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 16
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_not_disjoint64_uint16_t_double(i64 %ptr) {
; CHECK-P10-LABEL: ld_not_disjoint64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    lfd f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_not_disjoint64_uint16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    lfd f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 8
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_disjoint_align64_uint16_t_double(i64 %ptr) {
; CHECK-P10-LABEL: ld_disjoint_align64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    lfdx f0, r3, r4
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_disjoint_align64_uint16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    lfdx f0, r3, r4
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to double*
  %1 = load double, double* %0, align 4096
  %conv = fptoui double %1 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align16_uint16_t_double() {
; CHECK-LABEL: ld_cst_align16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lfd f0, 4080(0)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %0 = load double, double* inttoptr (i64 4080 to double*), align 16
  %conv = fptoui double %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align32_uint16_t_double() {
; CHECK-LABEL: ld_cst_align32_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    lfd f0, -27108(r3)
; CHECK-NEXT:    xscvdpsxws f0, f0
; CHECK-NEXT:    mffprwz r3, f0
; CHECK-NEXT:    clrldi r3, r3, 32
; CHECK-NEXT:    blr
entry:
  %0 = load double, double* inttoptr (i64 9999900 to double*), align 8
  %conv = fptoui double %0 to i16
  ret i16 %conv
}

; Function Attrs: norecurse nounwind readonly uwtable willreturn
define dso_local zeroext i16 @ld_cst_align64_uint16_t_double() {
; CHECK-P10-LABEL: ld_cst_align64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    lfd f0, 0(r3)
; CHECK-P10-NEXT:    xscvdpsxws f0, f0
; CHECK-P10-NEXT:    mffprwz r3, f0
; CHECK-P10-NEXT:    clrldi r3, r3, 32
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: ld_cst_align64_uint16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r3, 3725
; CHECK-PREP10-NEXT:    ori r3, r3, 19025
; CHECK-PREP10-NEXT:    rldic r3, r3, 12, 24
; CHECK-PREP10-NEXT:    lfd f0, 0(r3)
; CHECK-PREP10-NEXT:    xscvdpsxws f0, f0
; CHECK-PREP10-NEXT:    mffprwz r3, f0
; CHECK-PREP10-NEXT:    clrldi r3, r3, 32
; CHECK-PREP10-NEXT:    blr
entry:
  %0 = load double, double* inttoptr (i64 1000000000000 to double*), align 4096
  %conv = fptoui double %0 to i16
  ret i16 %conv
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_uint16_t_uint8_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_0_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stb r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %0 = inttoptr i64 %ptr to i8*
  store i8 %conv, i8* %0, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_uint16_t_uint8_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_align16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stb r4, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  store i8 %conv, i8* %add.ptr, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_uint16_t_uint8_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align32_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pstb r4, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align32_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 1525
; CHECK-PREP10-NEXT:    ori r5, r5, 56600
; CHECK-PREP10-NEXT:    stbx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  store i8 %conv, i8* %add.ptr, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_uint16_t_uint8_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stbx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stbx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  store i8 %conv, i8* %add.ptr, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_uint16_t_uint8_t(i8* nocapture %ptr, i64 %off, i16 zeroext %str) {
; CHECK-LABEL: st_reg_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stbx r5, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  store i8 %conv, i8* %add.ptr, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_uint16_t_uint8_t(i64 %ptr, i8 zeroext %off, i16 zeroext %str) {
; CHECK-LABEL: st_or1_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    stb r5, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to i8*
  store i8 %conv, i8* %0, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_uint16_t_uint8_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    stb r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i8*
  store i8 %conv, i8* %0, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_uint16_t_uint8_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_disjoint_align16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    stb r4, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = trunc i16 %str to i8
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i8*
  store i8 %conv, i8* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_uint16_t_uint8_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint32_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    stb r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i8*
  store i8 %conv, i8* %0, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_uint16_t_uint8_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    pstb r4, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_uint16_t_uint8_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    lis r5, 15258
; CHECK-P9-NEXT:    ori r5, r5, 41712
; CHECK-P9-NEXT:    stbx r4, r3, r5
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_uint16_t_uint8_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r5, -15264
; CHECK-P8-NEXT:    lis r6, 15258
; CHECK-P8-NEXT:    and r3, r3, r5
; CHECK-P8-NEXT:    ori r5, r6, 41712
; CHECK-P8-NEXT:    stbx r4, r3, r5
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = trunc i16 %str to i8
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i8*
  store i8 %conv, i8* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_uint16_t_uint8_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 232
; CHECK-P10-NEXT:    pli r6, 3567587329
; CHECK-P10-NEXT:    rldimi r6, r5, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r6
; CHECK-P10-NEXT:    stb r4, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r5, 29
; CHECK-PREP10-NEXT:    rldic r5, r5, 35, 24
; CHECK-PREP10-NEXT:    oris r5, r5, 54437
; CHECK-PREP10-NEXT:    ori r5, r5, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r5
; CHECK-PREP10-NEXT:    stb r4, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i8*
  store i8 %conv, i8* %0, align 1
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_uint16_t_uint8_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stbx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_disjoint_align64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stbx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = trunc i16 %str to i8
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i8*
  store i8 %conv, i8* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_uint16_t_uint8_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align16_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stb r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  store i8 %conv, i8* inttoptr (i64 4080 to i8*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_uint16_t_uint8_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align32_uint16_t_uint8_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r4, 153
; CHECK-NEXT:    stb r3, -27108(r4)
; CHECK-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  store i8 %conv, i8* inttoptr (i64 9999900 to i8*), align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_uint16_t_uint8_t(i16 zeroext %str) {
; CHECK-P10-LABEL: st_cst_align64_uint16_t_uint8_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    stb r3, 0(r4)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_cst_align64_uint16_t_uint8_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    stb r3, 0(r4)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = trunc i16 %str to i8
  store i8 %conv, i8* inttoptr (i64 1000000000000 to i8*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_uint16_t_uint16_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_0_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    sth r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %0 = inttoptr i64 %ptr to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_uint16_t_uint16_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_align16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    sth r4, 8(r3)
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_uint16_t_uint16_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align32_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    psth r4, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align32_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 1525
; CHECK-PREP10-NEXT:    ori r5, r5, 56600
; CHECK-PREP10-NEXT:    sthx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_uint16_t_uint16_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    sthx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    sthx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_uint16_t_uint16_t(i8* nocapture %ptr, i64 %off, i16 zeroext %str) {
; CHECK-LABEL: st_reg_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    sthx r5, r3, r4
; CHECK-NEXT:    blr
entry:
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_uint16_t_uint16_t(i64 %ptr, i8 zeroext %off, i16 zeroext %str) {
; CHECK-LABEL: st_or1_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    sth r5, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i8 %off to i64
  %or = or i64 %conv, %ptr
  %0 = inttoptr i64 %or to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_uint16_t_uint16_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    sth r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_uint16_t_uint16_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_disjoint_align16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    sth r4, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i16*
  store i16 %str, i16* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_uint16_t_uint16_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint32_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    sth r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_uint16_t_uint16_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    psth r4, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_uint16_t_uint16_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    lis r5, 15258
; CHECK-P9-NEXT:    ori r5, r5, 41712
; CHECK-P9-NEXT:    sthx r4, r3, r5
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_uint16_t_uint16_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r5, -15264
; CHECK-P8-NEXT:    lis r6, 15258
; CHECK-P8-NEXT:    and r3, r3, r5
; CHECK-P8-NEXT:    ori r5, r6, 41712
; CHECK-P8-NEXT:    sthx r4, r3, r5
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i16*
  store i16 %str, i16* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_uint16_t_uint16_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 232
; CHECK-P10-NEXT:    pli r6, 3567587329
; CHECK-P10-NEXT:    rldimi r6, r5, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r6
; CHECK-P10-NEXT:    sth r4, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r5, 29
; CHECK-PREP10-NEXT:    rldic r5, r5, 35, 24
; CHECK-PREP10-NEXT:    oris r5, r5, 54437
; CHECK-PREP10-NEXT:    ori r5, r5, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r5
; CHECK-PREP10-NEXT:    sth r4, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i16*
  store i16 %str, i16* %0, align 2
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_uint16_t_uint16_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    sthx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_disjoint_align64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    sthx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i16*
  store i16 %str, i16* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_uint16_t_uint16_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align16_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    sth r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  store i16 %str, i16* inttoptr (i64 4080 to i16*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_uint16_t_uint16_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align32_uint16_t_uint16_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r4, 153
; CHECK-NEXT:    sth r3, -27108(r4)
; CHECK-NEXT:    blr
entry:
  store i16 %str, i16* inttoptr (i64 9999900 to i16*), align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_uint16_t_uint16_t(i16 zeroext %str) {
; CHECK-P10-LABEL: st_cst_align64_uint16_t_uint16_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    sth r3, 0(r4)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_cst_align64_uint16_t_uint16_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    sth r3, 0(r4)
; CHECK-PREP10-NEXT:    blr
entry:
  store i16 %str, i16* inttoptr (i64 1000000000000 to i16*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_uint16_t_uint32_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_0_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stw r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %0 = inttoptr i64 %ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_uint16_t_uint32_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_align16_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stw r4, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_uint16_t_uint32_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align32_uint16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pstw r4, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align32_uint16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 1525
; CHECK-PREP10-NEXT:    ori r5, r5, 56600
; CHECK-PREP10-NEXT:    stwx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_uint16_t_uint32_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align64_uint16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stwx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align64_uint16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stwx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_uint16_t_uint32_t(i8* nocapture %ptr, i64 %off, i16 zeroext %str) {
; CHECK-LABEL: st_reg_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stwx r5, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_uint16_t_uint32_t(i64 %ptr, i8 zeroext %off, i16 zeroext %str) {
; CHECK-LABEL: st_or1_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    stw r5, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_uint16_t_uint32_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint16_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    stw r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_uint16_t_uint32_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_disjoint_align16_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    stw r4, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = zext i16 %str to i32
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_uint16_t_uint32_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint32_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    stw r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_uint16_t_uint32_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_uint16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    pstw r4, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_uint16_t_uint32_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    lis r5, 15258
; CHECK-P9-NEXT:    ori r5, r5, 41712
; CHECK-P9-NEXT:    stwx r4, r3, r5
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_uint16_t_uint32_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r5, -15264
; CHECK-P8-NEXT:    lis r6, 15258
; CHECK-P8-NEXT:    and r3, r3, r5
; CHECK-P8-NEXT:    ori r5, r6, 41712
; CHECK-P8-NEXT:    stwx r4, r3, r5
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = zext i16 %str to i32
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_uint16_t_uint32_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_uint16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 232
; CHECK-P10-NEXT:    pli r6, 3567587329
; CHECK-P10-NEXT:    rldimi r6, r5, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r6
; CHECK-P10-NEXT:    stw r4, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_uint16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r5, 29
; CHECK-PREP10-NEXT:    rldic r5, r5, 35, 24
; CHECK-PREP10-NEXT:    oris r5, r5, 54437
; CHECK-PREP10-NEXT:    ori r5, r5, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r5
; CHECK-PREP10-NEXT:    stw r4, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_uint16_t_uint32_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_uint16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stwx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_disjoint_align64_uint16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stwx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = zext i16 %str to i32
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_uint16_t_uint32_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align16_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stw r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  store i32 %conv, i32* inttoptr (i64 4080 to i32*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_uint16_t_uint32_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align32_uint16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r4, 153
; CHECK-NEXT:    stw r3, -27108(r4)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  store i32 %conv, i32* inttoptr (i64 9999900 to i32*), align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_uint16_t_uint32_t(i16 zeroext %str) {
; CHECK-P10-LABEL: st_cst_align64_uint16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    stw r3, 0(r4)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_cst_align64_uint16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    stw r3, 0(r4)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i32
  store i32 %conv, i32* inttoptr (i64 1000000000000 to i32*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_uint16_t_uint64_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_0_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    std r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %0 = inttoptr i64 %ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_uint16_t_uint64_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_align16_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    std r4, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_uint16_t_uint64_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align32_uint16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pstd r4, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align32_uint16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 1525
; CHECK-PREP10-NEXT:    ori r5, r5, 56600
; CHECK-PREP10-NEXT:    stdx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_uint16_t_uint64_t(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align64_uint16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stdx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align64_uint16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stdx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_uint16_t_uint64_t(i8* nocapture %ptr, i64 %off, i16 zeroext %str) {
; CHECK-LABEL: st_reg_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stdx r5, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_uint16_t_uint64_t(i64 %ptr, i8 zeroext %off, i16 zeroext %str) {
; CHECK-LABEL: st_or1_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    std r5, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_uint16_t_uint64_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint16_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    std r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_uint16_t_uint64_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_disjoint_align16_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    std r4, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = zext i16 %str to i64
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_uint16_t_uint64_t(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint32_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    std r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_uint16_t_uint64_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_uint16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    pstd r4, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_uint16_t_uint64_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    lis r5, 15258
; CHECK-P9-NEXT:    ori r5, r5, 41712
; CHECK-P9-NEXT:    stdx r4, r3, r5
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_uint16_t_uint64_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r5, -15264
; CHECK-P8-NEXT:    lis r6, 15258
; CHECK-P8-NEXT:    and r3, r3, r5
; CHECK-P8-NEXT:    ori r5, r6, 41712
; CHECK-P8-NEXT:    stdx r4, r3, r5
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = zext i16 %str to i64
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_uint16_t_uint64_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_uint16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 232
; CHECK-P10-NEXT:    pli r6, 3567587329
; CHECK-P10-NEXT:    rldimi r6, r5, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r6
; CHECK-P10-NEXT:    std r4, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_uint16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r5, 29
; CHECK-PREP10-NEXT:    rldic r5, r5, 35, 24
; CHECK-PREP10-NEXT:    oris r5, r5, 54437
; CHECK-PREP10-NEXT:    ori r5, r5, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r5
; CHECK-PREP10-NEXT:    std r4, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_uint16_t_uint64_t(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_uint16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stdx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_disjoint_align64_uint16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stdx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = zext i16 %str to i64
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_uint16_t_uint64_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align16_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    std r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  store i64 %conv, i64* inttoptr (i64 4080 to i64*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_uint16_t_uint64_t(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align32_uint16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r4, 153
; CHECK-NEXT:    std r3, -27108(r4)
; CHECK-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  store i64 %conv, i64* inttoptr (i64 9999900 to i64*), align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_uint16_t_uint64_t(i16 zeroext %str) {
; CHECK-P10-LABEL: st_cst_align64_uint16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    std r3, 0(r4)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_cst_align64_uint16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    std r3, 0(r4)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = zext i16 %str to i64
  store i64 %conv, i64* inttoptr (i64 1000000000000 to i64*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_uint16_t_float(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_0_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfs f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %0 = inttoptr i64 %ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_uint16_t_float(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_align16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfs f0, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_uint16_t_float(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align32_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    xscvuxdsp f0, f0
; CHECK-P10-NEXT:    pstfs f0, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align32_uint16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r4, 1525
; CHECK-P9-NEXT:    xscvuxdsp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 56600
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align32_uint16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r4, 1525
; CHECK-P8-NEXT:    ori r4, r4, 56600
; CHECK-P8-NEXT:    xscvuxdsp f0, f0
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_uint16_t_float(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvuxdsp f0, f0
; CHECK-P10-NEXT:    stfsx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align64_uint16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    xscvuxdsp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align64_uint16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r4, 3725
; CHECK-P8-NEXT:    ori r4, r4, 19025
; CHECK-P8-NEXT:    xscvuxdsp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_uint16_t_float(i8* nocapture %ptr, i64 %off, i16 zeroext %str) {
; CHECK-LABEL: st_reg_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r5
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfsx f0, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_uint16_t_float(i64 %ptr, i8 zeroext %off, i16 zeroext %str) {
; CHECK-LABEL: st_or1_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r5
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfs f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_uint16_t_float(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfs f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_uint16_t_float(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_disjoint_align16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfs f0, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = uitofp i16 %str to float
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_uint16_t_float(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint32_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    ori r3, r3, 34463
; CHECK-P10-NEXT:    oris r3, r3, 1
; CHECK-P10-NEXT:    xscvuxdsp f0, f0
; CHECK-P10-NEXT:    stfs f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_not_disjoint32_uint16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    ori r3, r3, 34463
; CHECK-P9-NEXT:    xscvuxdsp f0, f0
; CHECK-P9-NEXT:    oris r3, r3, 1
; CHECK-P9-NEXT:    stfs f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_not_disjoint32_uint16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    ori r3, r3, 34463
; CHECK-P8-NEXT:    oris r3, r3, 1
; CHECK-P8-NEXT:    xscvuxdsp f0, f0
; CHECK-P8-NEXT:    stfs f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_uint16_t_float(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    xscvuxdsp f0, f0
; CHECK-P10-NEXT:    pstfs f0, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_uint16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    xscvuxdsp f0, f0
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_uint16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    xscvuxdsp f0, f0
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = uitofp i16 %str to float
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_uint16_t_float(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    xscvuxdsp f0, f0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    stfs f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_uint16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    mtfprwz f0, r4
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    xscvuxdsp f0, f0
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    stfs f0, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_uint16_t_float(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvuxdsp f0, f0
; CHECK-P10-NEXT:    stfsx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align64_uint16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-NEXT:    xscvuxdsp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align64_uint16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r5, 3725
; CHECK-P8-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-NEXT:    ori r4, r5, 19025
; CHECK-P8-NEXT:    xscvuxdsp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = uitofp i16 %str to float
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_uint16_t_float(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align16_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r3
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfs f0, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  store float %conv, float* inttoptr (i64 4080 to float*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_uint16_t_float(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align32_uint16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r3
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    xscvuxdsp f0, f0
; CHECK-NEXT:    stfs f0, -27108(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  store float %conv, float* inttoptr (i64 9999900 to float*), align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_uint16_t_float(i16 zeroext %str) {
; CHECK-P10-LABEL: st_cst_align64_uint16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r3
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    xscvuxdsp f0, f0
; CHECK-P10-NEXT:    stfs f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_cst_align64_uint16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r3
; CHECK-P9-NEXT:    lis r3, 3725
; CHECK-P9-NEXT:    xscvuxdsp f0, f0
; CHECK-P9-NEXT:    ori r3, r3, 19025
; CHECK-P9-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-NEXT:    stfs f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_cst_align64_uint16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r3
; CHECK-P8-NEXT:    lis r3, 3725
; CHECK-P8-NEXT:    ori r3, r3, 19025
; CHECK-P8-NEXT:    xscvuxdsp f0, f0
; CHECK-P8-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-NEXT:    stfs f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to float
  store float %conv, float* inttoptr (i64 1000000000000 to float*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_uint16_t_double(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_0_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfd f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %0 = inttoptr i64 %ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_uint16_t_double(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_align16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfd f0, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_uint16_t_double(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align32_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    xscvuxddp f0, f0
; CHECK-P10-NEXT:    pstfd f0, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align32_uint16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r4, 1525
; CHECK-P9-NEXT:    xscvuxddp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 56600
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align32_uint16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r4, 1525
; CHECK-P8-NEXT:    ori r4, r4, 56600
; CHECK-P8-NEXT:    xscvuxddp f0, f0
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_uint16_t_double(i8* nocapture %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_align64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvuxddp f0, f0
; CHECK-P10-NEXT:    stfdx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align64_uint16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    xscvuxddp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align64_uint16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r4, 3725
; CHECK-P8-NEXT:    ori r4, r4, 19025
; CHECK-P8-NEXT:    xscvuxddp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_uint16_t_double(i8* nocapture %ptr, i64 %off, i16 zeroext %str) {
; CHECK-LABEL: st_reg_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r5
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfdx f0, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_uint16_t_double(i64 %ptr, i8 zeroext %off, i16 zeroext %str) {
; CHECK-LABEL: st_or1_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r5
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfd f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_uint16_t_double(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_not_disjoint16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfd f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_uint16_t_double(i64 %ptr, i16 zeroext %str) {
; CHECK-LABEL: st_disjoint_align16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r4
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfd f0, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = uitofp i16 %str to double
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_uint16_t_double(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint32_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    ori r3, r3, 34463
; CHECK-P10-NEXT:    oris r3, r3, 1
; CHECK-P10-NEXT:    xscvuxddp f0, f0
; CHECK-P10-NEXT:    stfd f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_not_disjoint32_uint16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    ori r3, r3, 34463
; CHECK-P9-NEXT:    xscvuxddp f0, f0
; CHECK-P9-NEXT:    oris r3, r3, 1
; CHECK-P9-NEXT:    stfd f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_not_disjoint32_uint16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    ori r3, r3, 34463
; CHECK-P8-NEXT:    oris r3, r3, 1
; CHECK-P8-NEXT:    xscvuxddp f0, f0
; CHECK-P8-NEXT:    stfd f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_uint16_t_double(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    xscvuxddp f0, f0
; CHECK-P10-NEXT:    pstfd f0, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_uint16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    xscvuxddp f0, f0
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_uint16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    xscvuxddp f0, f0
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = uitofp i16 %str to double
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_uint16_t_double(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    xscvuxddp f0, f0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    stfd f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_uint16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    mtfprwz f0, r4
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    xscvuxddp f0, f0
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    stfd f0, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_uint16_t_double(i64 %ptr, i16 zeroext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvuxddp f0, f0
; CHECK-P10-NEXT:    stfdx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align64_uint16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-NEXT:    xscvuxddp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align64_uint16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r4
; CHECK-P8-NEXT:    lis r5, 3725
; CHECK-P8-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-NEXT:    ori r4, r5, 19025
; CHECK-P8-NEXT:    xscvuxddp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = uitofp i16 %str to double
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_uint16_t_double(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align16_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r3
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfd f0, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  store double %conv, double* inttoptr (i64 4080 to double*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_uint16_t_double(i16 zeroext %str) {
; CHECK-LABEL: st_cst_align32_uint16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwz f0, r3
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    xscvuxddp f0, f0
; CHECK-NEXT:    stfd f0, -27108(r3)
; CHECK-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  store double %conv, double* inttoptr (i64 9999900 to double*), align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_uint16_t_double(i16 zeroext %str) {
; CHECK-P10-LABEL: st_cst_align64_uint16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwz f0, r3
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    xscvuxddp f0, f0
; CHECK-P10-NEXT:    stfd f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_cst_align64_uint16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwz f0, r3
; CHECK-P9-NEXT:    lis r3, 3725
; CHECK-P9-NEXT:    xscvuxddp f0, f0
; CHECK-P9-NEXT:    ori r3, r3, 19025
; CHECK-P9-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-NEXT:    stfd f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_cst_align64_uint16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwz f0, r3
; CHECK-P8-NEXT:    lis r3, 3725
; CHECK-P8-NEXT:    ori r3, r3, 19025
; CHECK-P8-NEXT:    xscvuxddp f0, f0
; CHECK-P8-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-NEXT:    stfd f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = uitofp i16 %str to double
  store double %conv, double* inttoptr (i64 1000000000000 to double*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_int16_t_uint32_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_0_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stw r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %0 = inttoptr i64 %ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_int16_t_uint32_t(i8* nocapture %ptr, i16 signext %str) {
; CHECK-LABEL: st_align16_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stw r4, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_int16_t_uint32_t(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align32_int16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pstw r4, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align32_int16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 1525
; CHECK-PREP10-NEXT:    ori r5, r5, 56600
; CHECK-PREP10-NEXT:    stwx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_int16_t_uint32_t(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align64_int16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stwx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align64_int16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stwx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_int16_t_uint32_t(i8* nocapture %ptr, i64 %off, i16 signext %str) {
; CHECK-LABEL: st_reg_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stwx r5, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_int16_t_uint32_t(i64 %ptr, i8 zeroext %off, i16 signext %str) {
; CHECK-LABEL: st_or1_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    stw r5, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_int16_t_uint32_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_not_disjoint16_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    stw r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_int16_t_uint32_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_disjoint_align16_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    stw r4, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = sext i16 %str to i32
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_int16_t_uint32_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_not_disjoint32_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    stw r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_int16_t_uint32_t(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_int16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    pstw r4, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_int16_t_uint32_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    lis r5, 15258
; CHECK-P9-NEXT:    ori r5, r5, 41712
; CHECK-P9-NEXT:    stwx r4, r3, r5
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_int16_t_uint32_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r5, -15264
; CHECK-P8-NEXT:    lis r6, 15258
; CHECK-P8-NEXT:    and r3, r3, r5
; CHECK-P8-NEXT:    ori r5, r6, 41712
; CHECK-P8-NEXT:    stwx r4, r3, r5
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = sext i16 %str to i32
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_int16_t_uint32_t(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_int16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 232
; CHECK-P10-NEXT:    pli r6, 3567587329
; CHECK-P10-NEXT:    rldimi r6, r5, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r6
; CHECK-P10-NEXT:    stw r4, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_int16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r5, 29
; CHECK-PREP10-NEXT:    rldic r5, r5, 35, 24
; CHECK-PREP10-NEXT:    oris r5, r5, 54437
; CHECK-PREP10-NEXT:    ori r5, r5, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r5
; CHECK-PREP10-NEXT:    stw r4, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_int16_t_uint32_t(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_int16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stwx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_disjoint_align64_int16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stwx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = sext i16 %str to i32
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i32*
  store i32 %conv, i32* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_int16_t_uint32_t(i16 signext %str) {
; CHECK-LABEL: st_cst_align16_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stw r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  store i32 %conv, i32* inttoptr (i64 4080 to i32*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_int16_t_uint32_t(i16 signext %str) {
; CHECK-LABEL: st_cst_align32_int16_t_uint32_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r4, 153
; CHECK-NEXT:    stw r3, -27108(r4)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  store i32 %conv, i32* inttoptr (i64 9999900 to i32*), align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_int16_t_uint32_t(i16 signext %str) {
; CHECK-P10-LABEL: st_cst_align64_int16_t_uint32_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    stw r3, 0(r4)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_cst_align64_int16_t_uint32_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    stw r3, 0(r4)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i32
  store i32 %conv, i32* inttoptr (i64 1000000000000 to i32*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_int16_t_uint64_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_0_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    std r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %0 = inttoptr i64 %ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_int16_t_uint64_t(i8* nocapture %ptr, i16 signext %str) {
; CHECK-LABEL: st_align16_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    std r4, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_int16_t_uint64_t(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align32_int16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pstd r4, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align32_int16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 1525
; CHECK-PREP10-NEXT:    ori r5, r5, 56600
; CHECK-PREP10-NEXT:    stdx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_int16_t_uint64_t(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align64_int16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stdx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_align64_int16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stdx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_int16_t_uint64_t(i8* nocapture %ptr, i64 %off, i16 signext %str) {
; CHECK-LABEL: st_reg_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    stdx r5, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_int16_t_uint64_t(i64 %ptr, i8 zeroext %off, i16 signext %str) {
; CHECK-LABEL: st_or1_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    std r5, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_int16_t_uint64_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_not_disjoint16_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    std r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_int16_t_uint64_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_disjoint_align16_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    std r4, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = sext i16 %str to i64
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_int16_t_uint64_t(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_not_disjoint32_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    ori r3, r3, 34463
; CHECK-NEXT:    oris r3, r3, 1
; CHECK-NEXT:    std r4, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_int16_t_uint64_t(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_int16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    pstd r4, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_int16_t_uint64_t:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    lis r5, 15258
; CHECK-P9-NEXT:    ori r5, r5, 41712
; CHECK-P9-NEXT:    stdx r4, r3, r5
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_int16_t_uint64_t:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    lis r5, -15264
; CHECK-P8-NEXT:    lis r6, 15258
; CHECK-P8-NEXT:    and r3, r3, r5
; CHECK-P8-NEXT:    ori r5, r6, 41712
; CHECK-P8-NEXT:    stdx r4, r3, r5
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = sext i16 %str to i64
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_int16_t_uint64_t(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_int16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 232
; CHECK-P10-NEXT:    pli r6, 3567587329
; CHECK-P10-NEXT:    rldimi r6, r5, 32, 0
; CHECK-P10-NEXT:    or r3, r3, r6
; CHECK-P10-NEXT:    std r4, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_int16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    li r5, 29
; CHECK-PREP10-NEXT:    rldic r5, r5, 35, 24
; CHECK-PREP10-NEXT:    oris r5, r5, 54437
; CHECK-PREP10-NEXT:    ori r5, r5, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r5
; CHECK-PREP10-NEXT:    std r4, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_int16_t_uint64_t(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_int16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r5, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r5, r5, 12, 24
; CHECK-P10-NEXT:    stdx r4, r3, r5
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_disjoint_align64_int16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r5, 3725
; CHECK-PREP10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-PREP10-NEXT:    ori r5, r5, 19025
; CHECK-PREP10-NEXT:    rldic r5, r5, 12, 24
; CHECK-PREP10-NEXT:    stdx r4, r3, r5
; CHECK-PREP10-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = sext i16 %str to i64
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to i64*
  store i64 %conv, i64* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_int16_t_uint64_t(i16 signext %str) {
; CHECK-LABEL: st_cst_align16_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    std r3, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  store i64 %conv, i64* inttoptr (i64 4080 to i64*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_int16_t_uint64_t(i16 signext %str) {
; CHECK-LABEL: st_cst_align32_int16_t_uint64_t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lis r4, 153
; CHECK-NEXT:    std r3, -27108(r4)
; CHECK-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  store i64 %conv, i64* inttoptr (i64 9999900 to i64*), align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_int16_t_uint64_t(i16 signext %str) {
; CHECK-P10-LABEL: st_cst_align64_int16_t_uint64_t:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    std r3, 0(r4)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_cst_align64_int16_t_uint64_t:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    lis r4, 3725
; CHECK-PREP10-NEXT:    ori r4, r4, 19025
; CHECK-PREP10-NEXT:    rldic r4, r4, 12, 24
; CHECK-PREP10-NEXT:    std r3, 0(r4)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sext i16 %str to i64
  store i64 %conv, i64* inttoptr (i64 1000000000000 to i64*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_int16_t_float(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_0_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfs f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %0 = inttoptr i64 %ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_int16_t_float(i8* nocapture %ptr, i16 signext %str) {
; CHECK-LABEL: st_align16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfs f0, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_int16_t_float(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align32_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    xscvsxdsp f0, f0
; CHECK-P10-NEXT:    pstfs f0, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align32_int16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r4, 1525
; CHECK-P9-NEXT:    xscvsxdsp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 56600
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align32_int16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r4, 1525
; CHECK-P8-NEXT:    ori r4, r4, 56600
; CHECK-P8-NEXT:    xscvsxdsp f0, f0
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_int16_t_float(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvsxdsp f0, f0
; CHECK-P10-NEXT:    stfsx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align64_int16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    xscvsxdsp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align64_int16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r4, 3725
; CHECK-P8-NEXT:    ori r4, r4, 19025
; CHECK-P8-NEXT:    xscvsxdsp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_int16_t_float(i8* nocapture %ptr, i64 %off, i16 signext %str) {
; CHECK-LABEL: st_reg_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r5
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfsx f0, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_int16_t_float(i64 %ptr, i8 zeroext %off, i16 signext %str) {
; CHECK-LABEL: st_or1_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r5
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfs f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_int16_t_float(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_not_disjoint16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfs f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_int16_t_float(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_disjoint_align16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfs f0, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = sitofp i16 %str to float
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_int16_t_float(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_not_disjoint32_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    ori r3, r3, 34463
; CHECK-P10-NEXT:    oris r3, r3, 1
; CHECK-P10-NEXT:    xscvsxdsp f0, f0
; CHECK-P10-NEXT:    stfs f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_not_disjoint32_int16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    ori r3, r3, 34463
; CHECK-P9-NEXT:    xscvsxdsp f0, f0
; CHECK-P9-NEXT:    oris r3, r3, 1
; CHECK-P9-NEXT:    stfs f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_not_disjoint32_int16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    ori r3, r3, 34463
; CHECK-P8-NEXT:    oris r3, r3, 1
; CHECK-P8-NEXT:    xscvsxdsp f0, f0
; CHECK-P8-NEXT:    stfs f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_int16_t_float(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    xscvsxdsp f0, f0
; CHECK-P10-NEXT:    pstfs f0, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_int16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    xscvsxdsp f0, f0
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_int16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    xscvsxdsp f0, f0
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = sitofp i16 %str to float
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_int16_t_float(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    xscvsxdsp f0, f0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    stfs f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_int16_t_float:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    mtfprwa f0, r4
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    xscvsxdsp f0, f0
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    stfs f0, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4
  ret void
}


; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_int16_t_float(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvsxdsp f0, f0
; CHECK-P10-NEXT:    stfsx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align64_int16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-NEXT:    xscvsxdsp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfsx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align64_int16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r5, 3725
; CHECK-P8-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-NEXT:    ori r4, r5, 19025
; CHECK-P8-NEXT:    xscvsxdsp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfsx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = sitofp i16 %str to float
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to float*
  store float %conv, float* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_int16_t_float(i16 signext %str) {
; CHECK-LABEL: st_cst_align16_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r3
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfs f0, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  store float %conv, float* inttoptr (i64 4080 to float*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_int16_t_float(i16 signext %str) {
; CHECK-LABEL: st_cst_align32_int16_t_float:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r3
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    xscvsxdsp f0, f0
; CHECK-NEXT:    stfs f0, -27108(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  store float %conv, float* inttoptr (i64 9999900 to float*), align 4
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_int16_t_float(i16 signext %str) {
; CHECK-P10-LABEL: st_cst_align64_int16_t_float:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r3
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    xscvsxdsp f0, f0
; CHECK-P10-NEXT:    stfs f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_cst_align64_int16_t_float:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r3
; CHECK-P9-NEXT:    lis r3, 3725
; CHECK-P9-NEXT:    xscvsxdsp f0, f0
; CHECK-P9-NEXT:    ori r3, r3, 19025
; CHECK-P9-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-NEXT:    stfs f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_cst_align64_int16_t_float:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r3
; CHECK-P8-NEXT:    lis r3, 3725
; CHECK-P8-NEXT:    ori r3, r3, 19025
; CHECK-P8-NEXT:    xscvsxdsp f0, f0
; CHECK-P8-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-NEXT:    stfs f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to float
  store float %conv, float* inttoptr (i64 1000000000000 to float*), align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_0_int16_t_double(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_0_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfd f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %0 = inttoptr i64 %ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align16_int16_t_double(i8* nocapture %ptr, i16 signext %str) {
; CHECK-LABEL: st_align16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfd f0, 8(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align32_int16_t_double(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align32_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    xscvsxddp f0, f0
; CHECK-P10-NEXT:    pstfd f0, 99999000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align32_int16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r4, 1525
; CHECK-P9-NEXT:    xscvsxddp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 56600
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align32_int16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r4, 1525
; CHECK-P8-NEXT:    ori r4, r4, 56600
; CHECK-P8-NEXT:    xscvsxddp f0, f0
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 99999000
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_align64_int16_t_double(i8* nocapture %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_align64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvsxddp f0, f0
; CHECK-P10-NEXT:    stfdx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_align64_int16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    xscvsxddp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_align64_int16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r4, 3725
; CHECK-P8-NEXT:    ori r4, r4, 19025
; CHECK-P8-NEXT:    xscvsxddp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 1000000000000
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_reg_int16_t_double(i8* nocapture %ptr, i64 %off, i16 signext %str) {
; CHECK-LABEL: st_reg_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r5
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfdx f0, r3, r4
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %off
  %0 = bitcast i8* %add.ptr to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_or1_int16_t_double(i64 %ptr, i8 zeroext %off, i16 signext %str) {
; CHECK-LABEL: st_or1_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r5
; CHECK-NEXT:    or r3, r4, r3
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfd f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %conv1 = zext i8 %off to i64
  %or = or i64 %conv1, %ptr
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint16_int16_t_double(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_not_disjoint16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    ori r3, r3, 6
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfd f0, 0(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %or = or i64 %ptr, 6
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align16_int16_t_double(i64 %ptr, i16 signext %str) {
; CHECK-LABEL: st_disjoint_align16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r4
; CHECK-NEXT:    rldicr r3, r3, 0, 51
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfd f0, 24(r3)
; CHECK-NEXT:    blr
entry:
  %and = and i64 %ptr, -4096
  %conv = sitofp i16 %str to double
  %or = or i64 %and, 24
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint32_int16_t_double(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_not_disjoint32_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    ori r3, r3, 34463
; CHECK-P10-NEXT:    oris r3, r3, 1
; CHECK-P10-NEXT:    xscvsxddp f0, f0
; CHECK-P10-NEXT:    stfd f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_not_disjoint32_int16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    ori r3, r3, 34463
; CHECK-P9-NEXT:    xscvsxddp f0, f0
; CHECK-P9-NEXT:    oris r3, r3, 1
; CHECK-P9-NEXT:    stfd f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_not_disjoint32_int16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    ori r3, r3, 34463
; CHECK-P8-NEXT:    oris r3, r3, 1
; CHECK-P8-NEXT:    xscvsxddp f0, f0
; CHECK-P8-NEXT:    stfd f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %or = or i64 %ptr, 99999
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align32_int16_t_double(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align32_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    lis r5, -15264
; CHECK-P10-NEXT:    and r3, r3, r5
; CHECK-P10-NEXT:    xscvsxddp f0, f0
; CHECK-P10-NEXT:    pstfd f0, 999990000(r3), 0
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align32_int16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r5, -15264
; CHECK-P9-NEXT:    lis r4, 15258
; CHECK-P9-NEXT:    xscvsxddp f0, f0
; CHECK-P9-NEXT:    and r3, r3, r5
; CHECK-P9-NEXT:    ori r4, r4, 41712
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align32_int16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r4, -15264
; CHECK-P8-NEXT:    lis r5, 15258
; CHECK-P8-NEXT:    and r3, r3, r4
; CHECK-P8-NEXT:    ori r4, r5, 41712
; CHECK-P8-NEXT:    xscvsxddp f0, f0
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1000341504
  %conv = sitofp i16 %str to double
  %or = or i64 %and, 999990000
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_not_disjoint64_int16_t_double(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_not_disjoint64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    pli r4, 232
; CHECK-P10-NEXT:    pli r5, 3567587329
; CHECK-P10-NEXT:    rldimi r5, r4, 32, 0
; CHECK-P10-NEXT:    xscvsxddp f0, f0
; CHECK-P10-NEXT:    or r3, r3, r5
; CHECK-P10-NEXT:    stfd f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-PREP10-LABEL: st_not_disjoint64_int16_t_double:
; CHECK-PREP10:       # %bb.0: # %entry
; CHECK-PREP10-NEXT:    mtfprwa f0, r4
; CHECK-PREP10-NEXT:    li r4, 29
; CHECK-PREP10-NEXT:    rldic r4, r4, 35, 24
; CHECK-PREP10-NEXT:    xscvsxddp f0, f0
; CHECK-PREP10-NEXT:    oris r4, r4, 54437
; CHECK-PREP10-NEXT:    ori r4, r4, 4097
; CHECK-PREP10-NEXT:    or r3, r3, r4
; CHECK-PREP10-NEXT:    stfd f0, 0(r3)
; CHECK-PREP10-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  %or = or i64 %ptr, 1000000000001
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_disjoint_align64_int16_t_double(i64 %ptr, i16 signext %str) {
; CHECK-P10-LABEL: st_disjoint_align64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r4
; CHECK-P10-NEXT:    pli r4, 244140625
; CHECK-P10-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P10-NEXT:    rldic r4, r4, 12, 24
; CHECK-P10-NEXT:    xscvsxddp f0, f0
; CHECK-P10-NEXT:    stfdx f0, r3, r4
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_disjoint_align64_int16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r4
; CHECK-P9-NEXT:    lis r4, 3725
; CHECK-P9-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P9-NEXT:    xscvsxddp f0, f0
; CHECK-P9-NEXT:    ori r4, r4, 19025
; CHECK-P9-NEXT:    rldic r4, r4, 12, 24
; CHECK-P9-NEXT:    stfdx f0, r3, r4
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_disjoint_align64_int16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r4
; CHECK-P8-NEXT:    lis r5, 3725
; CHECK-P8-NEXT:    rldicr r3, r3, 0, 23
; CHECK-P8-NEXT:    ori r4, r5, 19025
; CHECK-P8-NEXT:    xscvsxddp f0, f0
; CHECK-P8-NEXT:    rldic r4, r4, 12, 24
; CHECK-P8-NEXT:    stfdx f0, r3, r4
; CHECK-P8-NEXT:    blr
entry:
  %and = and i64 %ptr, -1099511627776
  %conv = sitofp i16 %str to double
  %or = or i64 %and, 1000000000000
  %0 = inttoptr i64 %or to double*
  store double %conv, double* %0, align 4096
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align16_int16_t_double(i16 signext %str) {
; CHECK-LABEL: st_cst_align16_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r3
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfd f0, 4080(0)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  store double %conv, double* inttoptr (i64 4080 to double*), align 16
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align32_int16_t_double(i16 signext %str) {
; CHECK-LABEL: st_cst_align32_int16_t_double:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mtfprwa f0, r3
; CHECK-NEXT:    lis r3, 153
; CHECK-NEXT:    xscvsxddp f0, f0
; CHECK-NEXT:    stfd f0, -27108(r3)
; CHECK-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  store double %conv, double* inttoptr (i64 9999900 to double*), align 8
  ret void
}

; Function Attrs: nofree norecurse nounwind uwtable willreturn writeonly
define dso_local void @st_cst_align64_int16_t_double(i16 signext %str) {
; CHECK-P10-LABEL: st_cst_align64_int16_t_double:
; CHECK-P10:       # %bb.0: # %entry
; CHECK-P10-NEXT:    mtfprwa f0, r3
; CHECK-P10-NEXT:    pli r3, 244140625
; CHECK-P10-NEXT:    rldic r3, r3, 12, 24
; CHECK-P10-NEXT:    xscvsxddp f0, f0
; CHECK-P10-NEXT:    stfd f0, 0(r3)
; CHECK-P10-NEXT:    blr
;
; CHECK-P9-LABEL: st_cst_align64_int16_t_double:
; CHECK-P9:       # %bb.0: # %entry
; CHECK-P9-NEXT:    mtfprwa f0, r3
; CHECK-P9-NEXT:    lis r3, 3725
; CHECK-P9-NEXT:    xscvsxddp f0, f0
; CHECK-P9-NEXT:    ori r3, r3, 19025
; CHECK-P9-NEXT:    rldic r3, r3, 12, 24
; CHECK-P9-NEXT:    stfd f0, 0(r3)
; CHECK-P9-NEXT:    blr
;
; CHECK-P8-LABEL: st_cst_align64_int16_t_double:
; CHECK-P8:       # %bb.0: # %entry
; CHECK-P8-NEXT:    mtfprwa f0, r3
; CHECK-P8-NEXT:    lis r3, 3725
; CHECK-P8-NEXT:    ori r3, r3, 19025
; CHECK-P8-NEXT:    xscvsxddp f0, f0
; CHECK-P8-NEXT:    rldic r3, r3, 12, 24
; CHECK-P8-NEXT:    stfd f0, 0(r3)
; CHECK-P8-NEXT:    blr
entry:
  %conv = sitofp i16 %str to double
  store double %conv, double* inttoptr (i64 1000000000000 to double*), align 4096
  ret void
}