Tim Northover | e0e3aef | 2013-01-31 12:12:40 +0000 | [diff] [blame^] | 1 | ; RUN: llc -verify-machineinstrs < %s -march=aarch64 | FileCheck %s |
| 2 | |
| 3 | define i32 @test_madd32(i32 %val0, i32 %val1, i32 %val2) { |
| 4 | ; CHECK: test_madd32: |
| 5 | %mid = mul i32 %val1, %val2 |
| 6 | %res = add i32 %val0, %mid |
| 7 | ; CHECK: madd {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 8 | ret i32 %res |
| 9 | } |
| 10 | |
| 11 | define i64 @test_madd64(i64 %val0, i64 %val1, i64 %val2) { |
| 12 | ; CHECK: test_madd64: |
| 13 | %mid = mul i64 %val1, %val2 |
| 14 | %res = add i64 %val0, %mid |
| 15 | ; CHECK: madd {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}} |
| 16 | ret i64 %res |
| 17 | } |
| 18 | |
| 19 | define i32 @test_msub32(i32 %val0, i32 %val1, i32 %val2) { |
| 20 | ; CHECK: test_msub32: |
| 21 | %mid = mul i32 %val1, %val2 |
| 22 | %res = sub i32 %val0, %mid |
| 23 | ; CHECK: msub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 24 | ret i32 %res |
| 25 | } |
| 26 | |
| 27 | define i64 @test_msub64(i64 %val0, i64 %val1, i64 %val2) { |
| 28 | ; CHECK: test_msub64: |
| 29 | %mid = mul i64 %val1, %val2 |
| 30 | %res = sub i64 %val0, %mid |
| 31 | ; CHECK: msub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}} |
| 32 | ret i64 %res |
| 33 | } |
| 34 | |
| 35 | define i64 @test_smaddl(i64 %acc, i32 %val1, i32 %val2) { |
| 36 | ; CHECK: test_smaddl: |
| 37 | %ext1 = sext i32 %val1 to i64 |
| 38 | %ext2 = sext i32 %val2 to i64 |
| 39 | %prod = mul i64 %ext1, %ext2 |
| 40 | %res = add i64 %acc, %prod |
| 41 | ; CHECK: smaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}} |
| 42 | ret i64 %res |
| 43 | } |
| 44 | |
| 45 | define i64 @test_smsubl(i64 %acc, i32 %val1, i32 %val2) { |
| 46 | ; CHECK: test_smsubl: |
| 47 | %ext1 = sext i32 %val1 to i64 |
| 48 | %ext2 = sext i32 %val2 to i64 |
| 49 | %prod = mul i64 %ext1, %ext2 |
| 50 | %res = sub i64 %acc, %prod |
| 51 | ; CHECK: smsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}} |
| 52 | ret i64 %res |
| 53 | } |
| 54 | |
| 55 | define i64 @test_umaddl(i64 %acc, i32 %val1, i32 %val2) { |
| 56 | ; CHECK: test_umaddl: |
| 57 | %ext1 = zext i32 %val1 to i64 |
| 58 | %ext2 = zext i32 %val2 to i64 |
| 59 | %prod = mul i64 %ext1, %ext2 |
| 60 | %res = add i64 %acc, %prod |
| 61 | ; CHECK: umaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}} |
| 62 | ret i64 %res |
| 63 | } |
| 64 | |
| 65 | define i64 @test_umsubl(i64 %acc, i32 %val1, i32 %val2) { |
| 66 | ; CHECK: test_umsubl: |
| 67 | %ext1 = zext i32 %val1 to i64 |
| 68 | %ext2 = zext i32 %val2 to i64 |
| 69 | %prod = mul i64 %ext1, %ext2 |
| 70 | %res = sub i64 %acc, %prod |
| 71 | ; CHECK: umsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}} |
| 72 | ret i64 %res |
| 73 | } |
| 74 | |
| 75 | define i64 @test_smulh(i64 %lhs, i64 %rhs) { |
| 76 | ; CHECK: test_smulh: |
| 77 | %ext1 = sext i64 %lhs to i128 |
| 78 | %ext2 = sext i64 %rhs to i128 |
| 79 | %res = mul i128 %ext1, %ext2 |
| 80 | %high = lshr i128 %res, 64 |
| 81 | %val = trunc i128 %high to i64 |
| 82 | ; CHECK: smulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}} |
| 83 | ret i64 %val |
| 84 | } |
| 85 | |
| 86 | define i64 @test_umulh(i64 %lhs, i64 %rhs) { |
| 87 | ; CHECK: test_umulh: |
| 88 | %ext1 = zext i64 %lhs to i128 |
| 89 | %ext2 = zext i64 %rhs to i128 |
| 90 | %res = mul i128 %ext1, %ext2 |
| 91 | %high = lshr i128 %res, 64 |
| 92 | %val = trunc i128 %high to i64 |
| 93 | ; CHECK: umulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}} |
| 94 | ret i64 %val |
| 95 | } |
| 96 | |
| 97 | define i32 @test_mul32(i32 %lhs, i32 %rhs) { |
| 98 | ; CHECK: test_mul32: |
| 99 | %res = mul i32 %lhs, %rhs |
| 100 | ; CHECK: mul {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 101 | ret i32 %res |
| 102 | } |
| 103 | |
| 104 | define i64 @test_mul64(i64 %lhs, i64 %rhs) { |
| 105 | ; CHECK: test_mul64: |
| 106 | %res = mul i64 %lhs, %rhs |
| 107 | ; CHECK: mul {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}} |
| 108 | ret i64 %res |
| 109 | } |
| 110 | |
| 111 | define i32 @test_mneg32(i32 %lhs, i32 %rhs) { |
| 112 | ; CHECK: test_mneg32: |
| 113 | %prod = mul i32 %lhs, %rhs |
| 114 | %res = sub i32 0, %prod |
| 115 | ; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 116 | ret i32 %res |
| 117 | } |
| 118 | |
| 119 | define i64 @test_mneg64(i64 %lhs, i64 %rhs) { |
| 120 | ; CHECK: test_mneg64: |
| 121 | %prod = mul i64 %lhs, %rhs |
| 122 | %res = sub i64 0, %prod |
| 123 | ; CHECK: mneg {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}} |
| 124 | ret i64 %res |
| 125 | } |
| 126 | |
| 127 | define i64 @test_smull(i32 %lhs, i32 %rhs) { |
| 128 | ; CHECK: test_smull: |
| 129 | %ext1 = sext i32 %lhs to i64 |
| 130 | %ext2 = sext i32 %rhs to i64 |
| 131 | %res = mul i64 %ext1, %ext2 |
| 132 | ; CHECK: smull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 133 | ret i64 %res |
| 134 | } |
| 135 | |
| 136 | define i64 @test_umull(i32 %lhs, i32 %rhs) { |
| 137 | ; CHECK: test_umull: |
| 138 | %ext1 = zext i32 %lhs to i64 |
| 139 | %ext2 = zext i32 %rhs to i64 |
| 140 | %res = mul i64 %ext1, %ext2 |
| 141 | ; CHECK: umull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 142 | ret i64 %res |
| 143 | } |
| 144 | |
| 145 | define i64 @test_smnegl(i32 %lhs, i32 %rhs) { |
| 146 | ; CHECK: test_smnegl: |
| 147 | %ext1 = sext i32 %lhs to i64 |
| 148 | %ext2 = sext i32 %rhs to i64 |
| 149 | %prod = mul i64 %ext1, %ext2 |
| 150 | %res = sub i64 0, %prod |
| 151 | ; CHECK: smnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 152 | ret i64 %res |
| 153 | } |
| 154 | |
| 155 | define i64 @test_umnegl(i32 %lhs, i32 %rhs) { |
| 156 | ; CHECK: test_umnegl: |
| 157 | %ext1 = zext i32 %lhs to i64 |
| 158 | %ext2 = zext i32 %rhs to i64 |
| 159 | %prod = mul i64 %ext1, %ext2 |
| 160 | %res = sub i64 0, %prod |
| 161 | ; CHECK: umnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} |
| 162 | ret i64 %res |
| 163 | } |