llvm.org GIT mirror llvm / e6fa7df
[X86][btver2] PR31902: Fix a crash in combineOrCmpEqZeroToCtlzSrl under fast math. In combineOrCmpEqZeroToCtlzSrl, replace "getConstantOperand == 0" by "isNullConstant" to account for floating point constants. Differential Revision: https://reviews.llvm.org/D29756 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294588 91177308-0d34-0410-b5e6-96231b3b80d8 Pierre Gousseau 3 years ago
2 changed file(s) with 32 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
3116531165 return N->getOpcode() == X86ISD::SETCC && N->hasOneUse() &&
3116631166 X86::CondCode(N->getConstantOperandVal(0)) == X86::COND_E &&
3116731167 N->getOperand(1).getOpcode() == X86ISD::CMP &&
31168 N->getOperand(1).getConstantOperandVal(1) == 0 &&
31168 isNullConstant(N->getOperand(1).getOperand(1)) &&
3116931169 N->getOperand(1).getValueType().bitsGE(MVT::i32);
3117031170 };
3117131171
340340 %lor.ext = zext i1 %0 to i32
341341 ret i32 %lor.ext
342342 }
343
344 ; PR31902 Fix a crash in combineOrCmpEqZeroToCtlzSrl under fast math.
345 define i32 @test_zext_cmp11(double %a, double %b) "no-nans-fp-math"="true" {
346 ; CHECK-LABEL: test_zext_cmp11:
347 ; CHECK: # BB#0: # %entry
348 ; CHECK-NEXT: vxorps %xmm2, %xmm2, %xmm2
349 ; CHECK-NEXT: vucomisd %xmm2, %xmm0
350 ; CHECK-NEXT: sete %al
351 ; CHECK-NEXT: vucomisd %xmm2, %xmm1
352 ; CHECK-NEXT: sete %cl
353 ; CHECK-NEXT: orb %al, %cl
354 ; CHECK-NEXT: movzbl %cl, %eax
355 ; CHECK-NEXT: retq
356 ;
357 ; NOFASTLZCNT-LABEL: test_zext_cmp11:
358 ; NOFASTLZCNT: # BB#0: # %entry
359 ; NOFASTLZCNT-NEXT: vxorps %xmm2, %xmm2, %xmm2
360 ; NOFASTLZCNT-NEXT: vucomisd %xmm2, %xmm0
361 ; NOFASTLZCNT-NEXT: sete %al
362 ; NOFASTLZCNT-NEXT: vucomisd %xmm2, %xmm1
363 ; NOFASTLZCNT-NEXT: sete %cl
364 ; NOFASTLZCNT-NEXT: orb %al, %cl
365 ; NOFASTLZCNT-NEXT: movzbl %cl, %eax
366 ; NOFASTLZCNT-NEXT: retq
367 entry:
368 %cmp = fcmp fast oeq double %a, 0.000000e+00
369 %cmp1 = fcmp fast oeq double %b, 0.000000e+00
370 %0 = or i1 %cmp, %cmp1
371 %conv = zext i1 %0 to i32
372 ret i32 %conv
373 }