Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/ldexp-ext.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

113 lines
4.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
define float @ldexp_zext_float(float %x, i1 %bool) {
; CHECK-LABEL: @ldexp_zext_float(
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[BOOL:%.*]], float 2.000000e+00, float 1.000000e+00
; CHECK-NEXT: [[LDEXP:%.*]] = fmul float [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret float [[LDEXP]]
;
%zext = zext i1 %bool to i32
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %zext)
ret float %ldexp
}
define float @ldexp_zext_float_negative(float %x, i8 %y) {
; CHECK-LABEL: @ldexp_zext_float_negative(
; CHECK-NEXT: [[ZEXT:%.*]] = zext i8 [[Y:%.*]] to i32
; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[ZEXT]])
; CHECK-NEXT: ret float [[LDEXP]]
;
%zext = zext i8 %y to i32
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %zext)
ret float %ldexp
}
define double @ldexp_zext_double(double %x, i1 %bool) {
; CHECK-LABEL: @ldexp_zext_double(
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[BOOL:%.*]], double 2.000000e+00, double 1.000000e+00
; CHECK-NEXT: [[LDEXP:%.*]] = fmul double [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret double [[LDEXP]]
;
%zext = zext i1 %bool to i32
%ldexp = call double @llvm.ldexp.f64.i32(double %x, i32 %zext)
ret double %ldexp
}
define double @ldexp_zext_double_fast_math(double %x, i1 %bool) {
; CHECK-LABEL: @ldexp_zext_double_fast_math(
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[BOOL:%.*]], double 2.000000e+00, double 1.000000e+00
; CHECK-NEXT: [[LDEXP:%.*]] = fmul reassoc double [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret double [[LDEXP]]
;
%zext = zext i1 %bool to i32
%ldexp = call reassoc double @llvm.ldexp.f64.i32(double %x, i32 %zext)
ret double %ldexp
}
define <2 x float> @ldexp_zext_float_vector(<2 x float> %x, <2 x i1> %bool) {
; CHECK-LABEL: @ldexp_zext_float_vector(
; CHECK-NEXT: [[TMP1:%.*]] = select <2 x i1> [[BOOL:%.*]], <2 x float> splat (float 2.000000e+00), <2 x float> splat (float 1.000000e+00)
; CHECK-NEXT: [[LDEXP:%.*]] = fmul <2 x float> [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[LDEXP]]
;
%zext = zext <2 x i1> %bool to <2 x i32>
%ldexp = call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> %x, <2 x i32> %zext)
ret <2 x float> %ldexp
}
define float @ldexp_sext_float(float %x, i1 %bool) {
; CHECK-LABEL: @ldexp_sext_float(
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[BOOL:%.*]], float 5.000000e-01, float 1.000000e+00
; CHECK-NEXT: [[LDEXP:%.*]] = fmul float [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret float [[LDEXP]]
;
%sext = sext i1 %bool to i32
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %sext)
ret float %ldexp
}
define float @ldexp_sext_float_negative(float %x, i8 %y) {
; CHECK-LABEL: @ldexp_sext_float_negative(
; CHECK-NEXT: [[SEXT:%.*]] = sext i8 [[Y:%.*]] to i32
; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[SEXT]])
; CHECK-NEXT: ret float [[LDEXP]]
;
%sext = sext i8 %y to i32
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %sext)
ret float %ldexp
}
define double @ldexp_sext_double(double %x, i1 %bool) {
; CHECK-LABEL: @ldexp_sext_double(
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[BOOL:%.*]], double 5.000000e-01, double 1.000000e+00
; CHECK-NEXT: [[LDEXP:%.*]] = fmul double [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret double [[LDEXP]]
;
%sext = sext i1 %bool to i32
%ldexp = call double @llvm.ldexp.f64.i32(double %x, i32 %sext)
ret double %ldexp
}
define double @ldexp_sext_double_fast_math(double %x, i1 %bool) {
; CHECK-LABEL: @ldexp_sext_double_fast_math(
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[BOOL:%.*]], double 5.000000e-01, double 1.000000e+00
; CHECK-NEXT: [[LDEXP:%.*]] = fmul reassoc double [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret double [[LDEXP]]
;
%sext = sext i1 %bool to i32
%ldexp = call reassoc double @llvm.ldexp.f64.i32(double %x, i32 %sext)
ret double %ldexp
}
define <2 x float> @ldexp_sext_float_vector(<2 x float> %x, <2 x i1> %bool) {
; CHECK-LABEL: @ldexp_sext_float_vector(
; CHECK-NEXT: [[TMP1:%.*]] = select <2 x i1> [[BOOL:%.*]], <2 x float> splat (float 5.000000e-01), <2 x float> splat (float 1.000000e+00)
; CHECK-NEXT: [[LDEXP:%.*]] = fmul <2 x float> [[X:%.*]], [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[LDEXP]]
;
%sext = sext <2 x i1> %bool to <2 x i32>
%ldexp = call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> %x, <2 x i32> %sext)
ret <2 x float> %ldexp
}