Chris Lattner | 95ab268 | 2006-03-17 20:04:40 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llc |
| 2 | ; Test that vectors are scalarized/lowered correctly. |
| 3 | |
| 4 | %f1 = type <1 x float> |
| 5 | %f2 = type <2 x float> |
| 6 | %f4 = type <4 x float> |
| 7 | %f8 = type <8 x float> |
| 8 | |
| 9 | implementation |
| 10 | |
Chris Lattner | 1e4af78 | 2006-03-19 00:20:03 +0000 | [diff] [blame^] | 11 | ;;; TEST HANDLING OF VARIOUS VECTOR SIZES |
| 12 | |
Chris Lattner | 95ab268 | 2006-03-17 20:04:40 +0000 | [diff] [blame] | 13 | void %test_f1(%f1 *%P, %f1* %Q, %f1 *%S) { |
| 14 | %p = load %f1 *%P |
| 15 | %q = load %f1* %Q |
| 16 | %R = add %f1 %p, %q |
| 17 | store %f1 %R, %f1 *%S |
| 18 | ret void |
| 19 | } |
| 20 | |
| 21 | void %test_f2(%f2 *%P, %f2* %Q, %f2 *%S) { |
| 22 | %p = load %f2* %P |
| 23 | %q = load %f2* %Q |
| 24 | %R = add %f2 %p, %q |
| 25 | store %f2 %R, %f2 *%S |
| 26 | ret void |
| 27 | } |
| 28 | |
| 29 | void %test_f4(%f4 *%P, %f4* %Q, %f4 *%S) { |
| 30 | %p = load %f4* %P |
| 31 | %q = load %f4* %Q |
| 32 | %R = add %f4 %p, %q |
| 33 | store %f4 %R, %f4 *%S |
| 34 | ret void |
| 35 | } |
| 36 | |
| 37 | void %test_f8(%f8 *%P, %f8* %Q, %f8 *%S) { |
| 38 | %p = load %f8* %P |
| 39 | %q = load %f8* %Q |
| 40 | %R = add %f8 %p, %q |
| 41 | store %f8 %R, %f8 *%S |
| 42 | ret void |
| 43 | } |
Chris Lattner | 1e4af78 | 2006-03-19 00:20:03 +0000 | [diff] [blame^] | 44 | |
| 45 | ;;; TEST VECTOR CONSTRUCTS |
| 46 | |
| 47 | void %test_cst(%f4 *%P, %f4 *%S) { |
| 48 | %p = load %f4* %P |
| 49 | %R = add %f4 %p, <float 0.1, float 1.0, float 2.0, float 4.5> |
| 50 | store %f4 %R, %f4 *%S |
| 51 | ret void |
| 52 | } |
| 53 | |
| 54 | void %test_zero(%f4 *%P, %f4 *%S) { |
| 55 | %p = load %f4* %P |
| 56 | %R = add %f4 %p, zeroinitializer |
| 57 | store %f4 %R, %f4 *%S |
| 58 | ret void |
| 59 | } |
| 60 | |
| 61 | void %test_undef(%f4 *%P, %f4 *%S) { |
| 62 | %p = load %f4* %P |
| 63 | %R = add %f4 %p, undef |
| 64 | store %f4 %R, %f4 *%S |
| 65 | ret void |
| 66 | } |