100 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X644 5; This test makes sure that the compiler does not crash with an6; assertion failure when trying to fold a vector shift left7; by immediate count if the type of the input vector is different8; to the result type.9;10; This happens for example when lowering a shift left of a MVT::v16i8 vector.11; This is custom lowered into the following sequence:12; count << 513; A = VSHLI(MVT::v8i16, r & (char16)15, 4)14; B = BITCAST MVT::v16i8, A15; VSELECT(r, B, count);16; count += count17; C = VSHLI(MVT::v8i16, r & (char16)63, 2)18; D = BITCAST MVT::v16i8, C19; r = VSELECT(r, C, count);20; count += count21; VSELECT(r, r+r, count);22; count = count << 5;23;24; Where 'r' is a vector of type MVT::v16i8, and25; 'count' is the vector shift count.26 27define <16 x i8> @do_not_crash(ptr, ptr, ptr, i32, i64, i8) {28; X86-LABEL: do_not_crash:29; X86: # %bb.0: # %entry30; X86-NEXT: movl {{[0-9]+}}(%esp), %eax31; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx32; X86-NEXT: movb %al, (%ecx)33; X86-NEXT: movd %eax, %xmm134; X86-NEXT: psllq $56, %xmm135; X86-NEXT: pcmpeqd %xmm3, %xmm336; X86-NEXT: psllw $5, %xmm137; X86-NEXT: por {{\.?LCPI[0-9]+_[0-9]+}}, %xmm138; X86-NEXT: pxor %xmm2, %xmm239; X86-NEXT: pxor %xmm0, %xmm040; X86-NEXT: pcmpgtb %xmm1, %xmm041; X86-NEXT: pxor %xmm0, %xmm342; X86-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm043; X86-NEXT: por %xmm3, %xmm044; X86-NEXT: paddb %xmm1, %xmm145; X86-NEXT: pxor %xmm3, %xmm346; X86-NEXT: pcmpgtb %xmm1, %xmm347; X86-NEXT: movdqa %xmm3, %xmm448; X86-NEXT: pandn %xmm0, %xmm449; X86-NEXT: psllw $2, %xmm050; X86-NEXT: pand %xmm3, %xmm051; X86-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm052; X86-NEXT: por %xmm4, %xmm053; X86-NEXT: paddb %xmm1, %xmm154; X86-NEXT: pcmpgtb %xmm1, %xmm255; X86-NEXT: movdqa %xmm2, %xmm156; X86-NEXT: pandn %xmm0, %xmm157; X86-NEXT: paddb %xmm0, %xmm058; X86-NEXT: pand %xmm2, %xmm059; X86-NEXT: por %xmm1, %xmm060; X86-NEXT: retl61;62; X64-LABEL: do_not_crash:63; X64: # %bb.0: # %entry64; X64-NEXT: movb %r9b, (%rdi)65; X64-NEXT: movd %r9d, %xmm166; X64-NEXT: psllq $56, %xmm167; X64-NEXT: pcmpeqd %xmm2, %xmm268; X64-NEXT: psllw $5, %xmm169; X64-NEXT: por {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm170; X64-NEXT: pxor %xmm3, %xmm371; X64-NEXT: pxor %xmm0, %xmm072; X64-NEXT: pcmpgtb %xmm1, %xmm073; X64-NEXT: pxor %xmm0, %xmm274; X64-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm075; X64-NEXT: por %xmm2, %xmm076; X64-NEXT: paddb %xmm1, %xmm177; X64-NEXT: pxor %xmm2, %xmm278; X64-NEXT: pcmpgtb %xmm1, %xmm279; X64-NEXT: movdqa %xmm2, %xmm480; X64-NEXT: pandn %xmm0, %xmm481; X64-NEXT: psllw $2, %xmm082; X64-NEXT: pand %xmm2, %xmm083; X64-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm084; X64-NEXT: por %xmm4, %xmm085; X64-NEXT: paddb %xmm1, %xmm186; X64-NEXT: pcmpgtb %xmm1, %xmm387; X64-NEXT: movdqa %xmm3, %xmm188; X64-NEXT: pandn %xmm0, %xmm189; X64-NEXT: paddb %xmm0, %xmm090; X64-NEXT: pand %xmm3, %xmm091; X64-NEXT: por %xmm1, %xmm092; X64-NEXT: retq93entry:94 store i8 %5, ptr %095 %L5 = load i8, ptr %096 %I8 = insertelement <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, i8 %L5, i32 797 %B51 = shl <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, %I898 ret <16 x i8> %B5199}100