; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 ; RUN: llc -mtriple=nvptx64-- -mcpu=sm_90 < %s | FileCheck %s ; fold (srl (bitcast (build_vector e0, ..., eN)), (N-1) * eltsize) -> (zext eN) ; ; On NVPTX, i8 is promoted to i16 during type legalization. This means ; BUILD_VECTOR v4i8 has i16 operands (wider than the i8 element type). ; The fold must truncate the promoted operand to the element size before ; zero-extending to the result type. define i32 @srl_bv_v4i8_extract_last(i8 %a, i8 %b, i8 %c, i8 %d) { ; CHECK-LABEL: srl_bv_v4i8_extract_last( ; CHECK: { ; CHECK-NEXT: .reg .b32 %r<2>; ; CHECK-EMPTY: ; CHECK-NEXT: // %bb.0: ; CHECK-NEXT: ld.param.b8 %r1, [srl_bv_v4i8_extract_last_param_3]; ; CHECK-NEXT: st.param.b32 [func_retval0], %r1; ; CHECK-NEXT: ret; %bv0 = insertelement <4 x i8> poison, i8 %a, i32 0 %bv1 = insertelement <4 x i8> %bv0, i8 %b, i32 1 %bv2 = insertelement <4 x i8> %bv1, i8 %c, i32 2 %bv3 = insertelement <4 x i8> %bv2, i8 %d, i32 3 %bc = bitcast <4 x i8> %bv3 to i32 %srl = lshr i32 %bc, 24 ret i32 %srl } ; v2i16 -> i32: i16 operands match element type (no promotion needed). define i32 @srl_bv_v2i16_extract_last(i16 %a, i16 %b) { ; CHECK-LABEL: srl_bv_v2i16_extract_last( ; CHECK: { ; CHECK-NEXT: .reg .b32 %r<2>; ; CHECK-EMPTY: ; CHECK-NEXT: // %bb.0: ; CHECK-NEXT: ld.param.b16 %r1, [srl_bv_v2i16_extract_last_param_1]; ; CHECK-NEXT: st.param.b32 [func_retval0], %r1; ; CHECK-NEXT: ret; %bv0 = insertelement <2 x i16> poison, i16 %a, i32 0 %bv1 = insertelement <2 x i16> %bv0, i16 %b, i32 1 %bc = bitcast <2 x i16> %bv1 to i32 %srl = lshr i32 %bc, 16 ret i32 %srl }