Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstSimplify/ConstProp/bitcast.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

100 lines
3.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
; PR2165
define <1 x i64> @test1() {
; CHECK-LABEL: @test1(
; CHECK-NEXT: ret <1 x i64> splat (i64 63)
;
%A = bitcast i64 63 to <1 x i64>
ret <1 x i64> %A
}
; Ensure that a FP source operand isn't propagated to an icmp.
@a = external global i16, align 1
@b = external global i16, align 1
define i1 @bad_icmp_constexpr_bitcast() {
; CHECK-LABEL: @bad_icmp_constexpr_bitcast(
; CHECK-NEXT: [[FADD:%.*]] = fadd float bitcast (i32 ptrtoint (ptr @b to i32) to float), 2.000000e+00
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast float [[FADD]] to i32
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 ptrtoint (ptr @a to i32), [[BITCAST]]
; CHECK-NEXT: ret i1 [[CMP]]
;
%fadd = fadd float bitcast (i32 ptrtoint (ptr @b to i32) to float), 2.0
%bitcast = bitcast float %fadd to i32
%cmp = icmp eq i32 ptrtoint (ptr @a to i32), %bitcast
ret i1 %cmp
}
; Ensure that an integer source operand isn't propagated to a fcmp.
@c = external global i16, align 1
@d = external global i16, align 1
define i1 @bad_fcmp_constexpr_bitcast() {
; CHECK-LABEL: @bad_fcmp_constexpr_bitcast(
; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float bitcast (i32 ptrtoint (ptr @c to i32) to float), bitcast (i32 add (i32 ptrtoint (ptr @d to i32), i32 2) to float)
; CHECK-NEXT: ret i1 [[CMP]]
;
%cmp = fcmp oeq float bitcast (i32 ptrtoint (ptr @c to i32) to float), bitcast (i32 add (i32 ptrtoint (ptr @d to i32), i32 2) to float)
ret i1 %cmp
}
; Ensure that an "ordered and equal" fcmp of a ConstantExpr to itself is not folded, since the ConstantExpr may be a NaN.
define i1 @fcmp_constexpr_oeq(float %conv) {
; CHECK-LABEL: @fcmp_constexpr_oeq(
; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
; CHECK-NEXT: ret i1 [[CMP]]
;
%cmp = fcmp oeq float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
ret i1 %cmp
}
; Ensure that an "unordered or not equal" fcmp of a ConstantExpr to itself is not folded, since the ConstantExpr may be a NaN.
define i1 @fcmp_constexpr_une(float %conv) {
; CHECK-LABEL: @fcmp_constexpr_une(
; CHECK-NEXT: [[CMP:%.*]] = fcmp une float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
; CHECK-NEXT: ret i1 [[CMP]]
;
%cmp = fcmp une float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
ret i1 %cmp
}
define i1 @fcmp_constexpr_ueq(float %conv) {
; CHECK-LABEL: @fcmp_constexpr_ueq(
; CHECK-NEXT: ret i1 true
;
%cmp = fcmp ueq float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
ret i1 %cmp
}
define i1 @fcmp_constexpr_one(float %conv) {
; CHECK-LABEL: @fcmp_constexpr_one(
; CHECK-NEXT: ret i1 false
;
%cmp = fcmp one float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
ret i1 %cmp
}
%T = type { i8 }
@G = external global %T
define ptr @bitcast_to_gep() {
; CHECK-LABEL: @bitcast_to_gep(
; CHECK-NEXT: ret ptr @G
;
ret ptr @G
}
define ptr addrspace(1) @addrspacecast_to_gep() {
; CHECK-LABEL: @addrspacecast_to_gep(
; CHECK-NEXT: ret ptr addrspace(1) addrspacecast (ptr @G to ptr addrspace(1))
;
%p = addrspacecast ptr @G to ptr addrspace(1)
ret ptr addrspace(1) %p
}