Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/bitcast-select-const-vector.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

130 lines
6.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -S -passes=instcombine < %s | FileCheck %s
define double @bitcast_v2i32_select_to_double_const_rhs(double %i, <2 x i32> %i41) {
; CHECK-LABEL: define double @bitcast_v2i32_select_to_double_const_rhs(
; CHECK-SAME: double [[I:%.*]], <2 x i32> [[I41:%.*]]) {
; CHECK-NEXT: [[I42:%.*]] = fcmp one double [[I]], +inf
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i32> [[I41]] to double
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = select i1 [[I42]], double [[TMP1]], double +qnan
; CHECK-NEXT: ret double [[ASTYPE13_I_I]]
;
%i42 = fcmp one double %i, 0x7FF0000000000000
%s.0.i.i = select i1 %i42, <2 x i32> %i41, <2 x i32> <i32 0, i32 2146959360>
%astype13.i.i = bitcast <2 x i32> %s.0.i.i to double
ret double %astype13.i.i
}
define double @bitcast_v2i32_select_to_double_const_lhs(double %i, <2 x i32> %i41) {
; CHECK-LABEL: define double @bitcast_v2i32_select_to_double_const_lhs(
; CHECK-SAME: double [[I:%.*]], <2 x i32> [[I41:%.*]]) {
; CHECK-NEXT: [[I42:%.*]] = fcmp one double [[I]], +inf
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i32> [[I41]] to double
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = select i1 [[I42]], double +qnan, double [[TMP1]]
; CHECK-NEXT: ret double [[ASTYPE13_I_I]]
;
%i42 = fcmp one double %i, 0x7FF0000000000000
%s.0.i.i = select i1 %i42, <2 x i32> <i32 0, i32 2146959360>, <2 x i32> %i41
%astype13.i.i = bitcast <2 x i32> %s.0.i.i to double
ret double %astype13.i.i
}
define <2 x i32> @bitcast_select_double_to_v2i32_const_rhs(i64 %i, double %i41) {
; CHECK-LABEL: define <2 x i32> @bitcast_select_double_to_v2i32_const_rhs(
; CHECK-SAME: i64 [[I:%.*]], double [[I41:%.*]]) {
; CHECK-NEXT: [[I42_NOT:%.*]] = icmp eq i64 [[I]], 0
; CHECK-NEXT: [[S_0_I_I:%.*]] = select nnan i1 [[I42_NOT]], double 1.000000e+00, double [[I41]]
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = bitcast double [[S_0_I_I]] to <2 x i32>
; CHECK-NEXT: ret <2 x i32> [[ASTYPE13_I_I]]
;
%i42 = icmp ne i64 %i, 0
%s.0.i.i = select nnan i1 %i42, double %i41, double 1.0
%astype13.i.i = bitcast double %s.0.i.i to <2 x i32>
ret <2 x i32> %astype13.i.i
}
define <2 x i32> @bitcast_select_double_to_v2i32_const_lhs(i64 %i, double %i41) {
; CHECK-LABEL: define <2 x i32> @bitcast_select_double_to_v2i32_const_lhs(
; CHECK-SAME: i64 [[I:%.*]], double [[I41:%.*]]) {
; CHECK-NEXT: [[I42_NOT:%.*]] = icmp eq i64 [[I]], 0
; CHECK-NEXT: [[S_0_I_I:%.*]] = select nnan i1 [[I42_NOT]], double [[I41]], double 1.000000e+00
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = bitcast double [[S_0_I_I]] to <2 x i32>
; CHECK-NEXT: ret <2 x i32> [[ASTYPE13_I_I]]
;
%i42 = icmp ne i64 %i, 0
%s.0.i.i = select nnan i1 %i42, double 1.0, double %i41
%astype13.i.i = bitcast double %s.0.i.i to <2 x i32>
ret <2 x i32> %astype13.i.i
}
; Negative test, don't do for vselect
define double @bitcast_v2i32_vselect_to_double_const_rhs(<2 x double> %cmp.vec, <2 x i32> %val) {
; CHECK-LABEL: define double @bitcast_v2i32_vselect_to_double_const_rhs(
; CHECK-SAME: <2 x double> [[CMP_VEC:%.*]], <2 x i32> [[VAL:%.*]]) {
; CHECK-NEXT: [[VCMP:%.*]] = fcmp one <2 x double> [[CMP_VEC]], splat (double +inf)
; CHECK-NEXT: [[S_0_I_I:%.*]] = select <2 x i1> [[VCMP]], <2 x i32> [[VAL]], <2 x i32> <i32 0, i32 2146959360>
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = bitcast <2 x i32> [[S_0_I_I]] to double
; CHECK-NEXT: ret double [[ASTYPE13_I_I]]
;
%vcmp = fcmp one <2 x double> %cmp.vec, splat (double 0x7FF0000000000000)
%select = select <2 x i1> %vcmp, <2 x i32> %val, <2 x i32> <i32 0, i32 2146959360>
%cast = bitcast <2 x i32> %select to double
ret double %cast
}
define <2 x float> @bitcast_v4i16_select_to_v2f32_const_lhs(double %arg, <4 x i16> %vec.v4i16) {
; CHECK-LABEL: define <2 x float> @bitcast_v4i16_select_to_v2f32_const_lhs(
; CHECK-SAME: double [[ARG:%.*]], <4 x i16> [[VEC_V4I16:%.*]]) {
; CHECK-NEXT: [[CMP:%.*]] = fcmp one double [[ARG]], +inf
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i16> [[VEC_V4I16]] to <2 x float>
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = select i1 [[CMP]], <2 x float> <float f0x5B950000, float f0x85BA270F>, <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[ASTYPE13_I_I]]
;
%cmp = fcmp one double %arg, 0x7FF0000000000000
%select = select i1 %cmp, <4 x i16> <i16 0, i16 23445, i16 9999, i16 34234>, <4 x i16> %vec.v4i16
%astype13.i.i = bitcast <4 x i16> %select to <2 x float>
ret <2 x float> %astype13.i.i
}
define <2 x float> @bitcast_v4i16_select_to_v2f32_const_rhs(double %arg, <4 x i16> %vec.v4i16) {
; CHECK-LABEL: define <2 x float> @bitcast_v4i16_select_to_v2f32_const_rhs(
; CHECK-SAME: double [[ARG:%.*]], <4 x i16> [[VEC_V4I16:%.*]]) {
; CHECK-NEXT: [[CMP:%.*]] = fcmp one double [[ARG]], +inf
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i16> [[VEC_V4I16]] to <2 x float>
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = select i1 [[CMP]], <2 x float> [[TMP1]], <2 x float> <float f0x5B950000, float f0x85BA270F>
; CHECK-NEXT: ret <2 x float> [[ASTYPE13_I_I]]
;
%cmp = fcmp one double %arg, 0x7FF0000000000000
%select = select i1 %cmp, <4 x i16> %vec.v4i16, <4 x i16> <i16 0, i16 23445, i16 9999, i16 34234>
%astype13.i.i = bitcast <4 x i16> %select to <2 x float>
ret <2 x float> %astype13.i.i
}
define <2 x float> @bitcast_v2i32_select_to_v2f32_const_rhs(double %arg, <2 x i32> %vec) {
; CHECK-LABEL: define <2 x float> @bitcast_v2i32_select_to_v2f32_const_rhs(
; CHECK-SAME: double [[ARG:%.*]], <2 x i32> [[VEC:%.*]]) {
; CHECK-NEXT: [[I42:%.*]] = fcmp one double [[ARG]], +inf
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i32> [[VEC]] to <2 x float>
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = select i1 [[I42]], <2 x float> [[TMP1]], <2 x float> <float 0.000000e+00, float +nan(0x380000)>
; CHECK-NEXT: ret <2 x float> [[ASTYPE13_I_I]]
;
%cmp = fcmp one double %arg, 0x7FF0000000000000
%s.0.i.i = select i1 %cmp, <2 x i32> %vec, <2 x i32> <i32 0, i32 2146959360>
%astype13.i.i = bitcast <2 x i32> %s.0.i.i to <2 x float>
ret <2 x float> %astype13.i.i
}
define <2 x float> @bitcast_v2i32_select_to_v2f32_const_lhs(double %arg, <2 x i32> %vec) {
; CHECK-LABEL: define <2 x float> @bitcast_v2i32_select_to_v2f32_const_lhs(
; CHECK-SAME: double [[ARG:%.*]], <2 x i32> [[VEC:%.*]]) {
; CHECK-NEXT: [[CMP:%.*]] = fcmp one double [[ARG]], +inf
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i32> [[VEC]] to <2 x float>
; CHECK-NEXT: [[ASTYPE13_I_I:%.*]] = select i1 [[CMP]], <2 x float> <float 0.000000e+00, float +nan(0x380000)>, <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[ASTYPE13_I_I]]
;
%cmp = fcmp one double %arg, 0x7FF0000000000000
%s.0.i.i = select i1 %cmp, <2 x i32> <i32 0, i32 2146959360>, <2 x i32> %vec
%astype13.i.i = bitcast <2 x i32> %s.0.i.i to <2 x float>
ret <2 x float> %astype13.i.i
}