llvm/llvm/test/Transforms/SLPVectorizer/X86/float-min-max.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=slp-vectorizer -S %s | FileCheck %s

target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
target triple = "i386-unknown-linux-gnu"

; Make sure we do not crash while computing the cost for @test.
define i1 @test(ptr %p1, ptr %p2, ptr %p3, i1 %c) #0 {
; CHECK-LABEL: @test(
; CHECK-NEXT:    [[L0:%.*]] = icmp ult ptr [[P2:%.*]], [[P1:%.*]]
; CHECK-NEXT:    [[UMIN:%.*]] = select i1 [[L0]], ptr [[P2]], ptr [[P1]]
; CHECK-NEXT:    [[SCEVGEP31:%.*]] = getelementptr float, ptr [[P1]], i32 1
; CHECK-NEXT:    [[L1:%.*]] = icmp ult ptr [[SCEVGEP31]], [[P2]]
; CHECK-NEXT:    [[UMIN33:%.*]] = select i1 [[L1]], ptr [[SCEVGEP31]], ptr [[P2]]
; CHECK-NEXT:    [[BOUND0:%.*]] = icmp ugt ptr [[P3:%.*]], [[UMIN]]
; CHECK-NEXT:    [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[C:%.*]]
; CHECK-NEXT:    [[BOUND042:%.*]] = icmp ugt ptr [[P3]], [[UMIN33]]
; CHECK-NEXT:    [[FOUND_CONFLICT44:%.*]] = and i1 [[BOUND042]], [[C]]
; CHECK-NEXT:    [[OP_RDX:%.*]] = or i1 [[C]], [[FOUND_CONFLICT]]
; CHECK-NEXT:    [[OP_RDX1:%.*]] = or i1 [[OP_RDX]], [[FOUND_CONFLICT44]]
; CHECK-NEXT:    ret i1 [[OP_RDX1]]
;
  %l0 = icmp ult ptr %p2, %p1
  %umin = select i1 %l0, ptr %p2, ptr %p1
  %scevgep31 = getelementptr float, ptr %p1, i32 1
  %l1 = icmp ult ptr %scevgep31, %p2
  %umin33 = select i1 %l1, ptr %scevgep31, ptr %p2
  %bound0 = icmp ugt ptr %p3, %umin
  %found.conflict = and i1 %bound0, %c
  %conflict.rdx = or i1 %found.conflict, %c
  %bound042 = icmp ugt ptr %p3, %umin33
  %found.conflict44 = and i1 %bound042, %c
  %conflict.rdx45 = or i1 %conflict.rdx, %found.conflict44
  %conflict.rdx49 = or i1 %conflict.rdx45, %c
  ret i1 %conflict.rdx49
}

attributes #0 = { "target-cpu"="pentium-m" }