diff --git a/llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll b/llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll --- a/llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll +++ b/llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -slp-vectorizer -mattr=+avx2 -S | FileCheck %s +; RUN: opt < %s -slp-vectorizer -mattr=+avx2 -march=corei7-avx -S | FileCheck %s target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -55,3 +55,44 @@ } attributes #0 = { "unsafe-fp-math"="true" } + +; This test checks that root steering works and that the code gets vectorized. + +define void @root_steering() { +; CHECK-LABEL: @root_steering( +; CHECK-NEXT: bb: +; CHECK-NEXT: [[CHAIN2_2:%.*]] = fadd double 4.000000e-01, 5.000000e-01 +; CHECK-NEXT: [[CHAIN2_1:%.*]] = fmul double 3.000000e-01, [[CHAIN2_2]] +; CHECK-NEXT: [[ROOT5:%.*]] = fadd double 2.000000e-01, [[CHAIN2_1]] +; CHECK-NEXT: [[ROOT3:%.*]] = fmul double 3.000000e-01, 2.000000e-01 +; CHECK-NEXT: [[MUL:%.*]] = fmul double [[ROOT3]], 1.000000e-01 +; CHECK-NEXT: [[CHAINB_3:%.*]] = fadd double 3.000000e-01, 4.000000e-01 +; CHECK-NEXT: [[CHAINB_2:%.*]] = fmul double 2.000000e-01, [[CHAINB_3]] +; CHECK-NEXT: [[CHAINB_1:%.*]] = fadd double 1.000000e-01, [[CHAINB_2]] +; CHECK-NEXT: [[ROOT4:%.*]] = fmul double [[MUL]], [[CHAINB_1]] +; CHECK-NEXT: [[ROOT2:%.*]] = fadd double 1.000000e-01, [[ROOT4]] +; CHECK-NEXT: [[ROOT1:%.*]] = fmul double [[ROOT3]], [[ROOT5]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[ROOT1]], [[ROOT2]] +; CHECK-NEXT: [[SEED:%.*]] = fcmp ogt double [[DIV]], 3.000000e-01 +; CHECK-NEXT: ret void +; +bb: + %chain2_2 = fadd double 0.4, 0.5 + %chain2_1 = fmul double 0.3, %chain2_2 + %root5 = fadd double 0.2, %chain2_1 + + %root3 = fmul double 0.3, 0.2 + %mul = fmul double %root3, 0.1 + + %chainB_3 = fadd double 0.3, 0.4 + %chainB_2 = fmul double 0.2, %chainB_3 + %chainB_1 = fadd double 0.1, %chainB_2 + %root4 = fmul double %mul, %chainB_1 + %root2 = fadd double 0.1, %root4 + + %root1 = fmul double %root3, %root5 + %div = fdiv double %root1, %root2 + + %seed = fcmp ogt double %div, 0.3 + ret void +}