diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -24564,6 +24564,11 @@ SDValue LHS = Src.getOperand(0); SDValue RHS = Src.getOperand(1); EVT LHSVT = LHS.getValueType(); + if (LHSVT.isFloatingPoint()) { + LHSVT = LHSVT.changeVectorElementTypeToInteger(); + LHS = DAG.getBitcast(LHSVT, LHS); + RHS = DAG.getBitcast(LHSVT, RHS); + } ISD::CondCode SrcCC = cast(Src.getOperand(2))->get(); if (SrcCC == (CmpNull ? ISD::SETNE : ISD::SETEQ) && llvm::has_single_bit(LHSVT.getSizeInBits())) { diff --git a/llvm/test/CodeGen/X86/pr53419.ll b/llvm/test/CodeGen/X86/pr53419.ll --- a/llvm/test/CodeGen/X86/pr53419.ll +++ b/llvm/test/CodeGen/X86/pr53419.ll @@ -1,9 +1,9 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=X64 -; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse4.2 | FileCheck %s --check-prefixes=X64 -; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx | FileCheck %s --check-prefixes=X64 -; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=X64 -; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefixes=X64 +; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=X64,SSE2 +; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse4.2 | FileCheck %s --check-prefixes=X64,SSE42 +; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx | FileCheck %s --check-prefixes=X64,AVX +; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=X64,AVX +; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefixes=X64,AVX ; RUN: llc < %s -mtriple=i686-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=X86 declare i1 @llvm.vector.reduce.and.v2i1(<2 x i1>) @@ -314,3 +314,83 @@ %all_eq = icmp eq i64 %lhs, %rhs ret i1 %all_eq } + +define void @vector_version_v8f32(<8 x float> %a) { +; SSE2-LABEL: vector_version_v8f32: +; SSE2: # %bb.0: # %bb +; SSE2-NEXT: por %xmm1, %xmm0 +; SSE2-NEXT: pxor %xmm1, %xmm1 +; SSE2-NEXT: pcmpeqd %xmm0, %xmm1 +; SSE2-NEXT: movmskps %xmm1, %eax +; SSE2-NEXT: xorl $15, %eax +; SSE2-NEXT: jne .LBB12_3 +; SSE2-NEXT: # %bb.1: # %bb +; SSE2-NEXT: xorl %eax, %eax +; SSE2-NEXT: testb %al, %al +; SSE2-NEXT: jne .LBB12_3 +; SSE2-NEXT: # %bb.2: # %bb +; SSE2-NEXT: xorl %eax, %eax +; SSE2-NEXT: testb %al, %al +; SSE2-NEXT: je .LBB12_3 +; SSE2-NEXT: # %bb.4: # %if.end +; SSE2-NEXT: .LBB12_3: # %if.then +; +; SSE42-LABEL: vector_version_v8f32: +; SSE42: # %bb.0: # %bb +; SSE42-NEXT: por %xmm1, %xmm0 +; SSE42-NEXT: ptest %xmm0, %xmm0 +; SSE42-NEXT: jne .LBB12_3 +; SSE42-NEXT: # %bb.1: # %bb +; SSE42-NEXT: xorl %eax, %eax +; SSE42-NEXT: testb %al, %al +; SSE42-NEXT: jne .LBB12_3 +; SSE42-NEXT: # %bb.2: # %bb +; SSE42-NEXT: xorl %eax, %eax +; SSE42-NEXT: testb %al, %al +; SSE42-NEXT: je .LBB12_3 +; SSE42-NEXT: # %bb.4: # %if.end +; SSE42-NEXT: .LBB12_3: # %if.then +; +; AVX-LABEL: vector_version_v8f32: +; AVX: # %bb.0: # %bb +; AVX-NEXT: vptest %ymm0, %ymm0 +; AVX-NEXT: jne .LBB12_3 +; AVX-NEXT: # %bb.1: # %bb +; AVX-NEXT: xorl %eax, %eax +; AVX-NEXT: testb %al, %al +; AVX-NEXT: jne .LBB12_3 +; AVX-NEXT: # %bb.2: # %bb +; AVX-NEXT: xorl %eax, %eax +; AVX-NEXT: testb %al, %al +; AVX-NEXT: je .LBB12_3 +; AVX-NEXT: # %bb.4: # %if.end +; AVX-NEXT: .LBB12_3: # %if.then +; +; X86-LABEL: vector_version_v8f32: +; X86: # %bb.0: # %bb +; X86-NEXT: vptest %ymm0, %ymm0 +; X86-NEXT: jne .LBB12_3 +; X86-NEXT: # %bb.1: # %bb +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: testb %al, %al +; X86-NEXT: jne .LBB12_3 +; X86-NEXT: # %bb.2: # %bb +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: testb %al, %al +; X86-NEXT: je .LBB12_3 +; X86-NEXT: # %bb.4: # %if.end +; X86-NEXT: .LBB12_3: # %if.then +bb: + %0 = fcmp nnan une <8 x float> %a, zeroinitializer + %1 = bitcast <8 x i1> %0 to i8 + %2 = icmp ne i8 %1, 0 + %op.rdx = or i1 %2, poison + %op.rdx93 = select i1 %op.rdx, i1 true, i1 poison + br i1 %op.rdx93, label %if.then, label %if.end + +if.then: ; preds = %entry + unreachable + +if.end: ; preds = %entry + unreachable +}