1 ; RUN: llc -march=x86 -mattr=+sse < %s | FileCheck %s 2 3 %vec = type <6 x float> 4 ; CHECK: divss 5 ; CHECK: divss 6 ; CHECK: divps 7 define %vec @vecdiv( %vec %p1, %vec %p2) 8 { 9 %result = fdiv %vec %p1, %p2 10 ret %vec %result 11 } 12 13 @a = constant %vec < float 2.0, float 4.0, float 8.0, float 16.0, float 32.0, float 64.0 > 14 @b = constant %vec < float 2.0, float 2.0, float 2.0, float 2.0, float 2.0, float 2.0 > 15 16 ; Expected result: < 1.0, 2.0, 4.0, ..., 2.0^(n-1) > 17 ; main() returns 0 if the result is expected and 1 otherwise 18 ; to execute, use llvm-as < %s | lli 19 define i32 @main() nounwind { 20 entry: 21 %avec = load %vec* @a 22 %bvec = load %vec* @b 23 24 %res = call %vec @vecdiv(%vec %avec, %vec %bvec) 25 br label %loop 26 loop: 27 %idx = phi i32 [0, %entry], [%nextInd, %looptail] 28 %expected = phi float [1.0, %entry], [%nextExpected, %looptail] 29 %elem = extractelement %vec %res, i32 %idx 30 %expcmp = fcmp oeq float %elem, %expected 31 br i1 %expcmp, label %looptail, label %return 32 looptail: 33 %nextExpected = fmul float %expected, 2.0 34 %nextInd = add i32 %idx, 1 35 %cmp = icmp slt i32 %nextInd, 6 36 br i1 %cmp, label %loop, label %return 37 return: 38 %retval = phi i32 [0, %looptail], [1, %loop] 39 ret i32 %retval 40 } 41