Bruno Cardoso Lopes | 8be7611 | 2011-01-18 19:29:17 +0000 | [diff] [blame^] | 1 | ; RUN: llc -march=mips -mcpu=4ke < %s | FileCheck %s |
| 2 | |
| 3 | ; CHECK: madd $5, $4 |
| 4 | define i64 @madd1(i32 %a, i32 %b, i32 %c) nounwind readnone { |
| 5 | entry: |
| 6 | %conv = sext i32 %a to i64 |
| 7 | %conv2 = sext i32 %b to i64 |
| 8 | %mul = mul nsw i64 %conv2, %conv |
| 9 | %conv4 = sext i32 %c to i64 |
| 10 | %add = add nsw i64 %mul, %conv4 |
| 11 | ret i64 %add |
| 12 | } |
| 13 | |
| 14 | ; CHECK: maddu $5, $4 |
| 15 | define i64 @madd2(i32 %a, i32 %b, i32 %c) nounwind readnone { |
| 16 | entry: |
| 17 | %conv = zext i32 %a to i64 |
| 18 | %conv2 = zext i32 %b to i64 |
| 19 | %mul = mul nsw i64 %conv2, %conv |
| 20 | %conv4 = zext i32 %c to i64 |
| 21 | %add = add nsw i64 %mul, %conv4 |
| 22 | ret i64 %add |
| 23 | } |
| 24 | |
| 25 | ; CHECK: madd $5, $4 |
| 26 | define i64 @madd3(i32 %a, i32 %b, i64 %c) nounwind readnone { |
| 27 | entry: |
| 28 | %conv = sext i32 %a to i64 |
| 29 | %conv2 = sext i32 %b to i64 |
| 30 | %mul = mul nsw i64 %conv2, %conv |
| 31 | %add = add nsw i64 %mul, %c |
| 32 | ret i64 %add |
| 33 | } |
| 34 | |
| 35 | ; CHECK: msub $5, $4 |
| 36 | define i64 @msub1(i32 %a, i32 %b, i32 %c) nounwind readnone { |
| 37 | entry: |
| 38 | %conv = sext i32 %c to i64 |
| 39 | %conv2 = sext i32 %a to i64 |
| 40 | %conv4 = sext i32 %b to i64 |
| 41 | %mul = mul nsw i64 %conv4, %conv2 |
| 42 | %sub = sub nsw i64 %conv, %mul |
| 43 | ret i64 %sub |
| 44 | } |
| 45 | |
| 46 | ; CHECK: msubu $5, $4 |
| 47 | define i64 @msub2(i32 %a, i32 %b, i32 %c) nounwind readnone { |
| 48 | entry: |
| 49 | %conv = zext i32 %c to i64 |
| 50 | %conv2 = zext i32 %a to i64 |
| 51 | %conv4 = zext i32 %b to i64 |
| 52 | %mul = mul nsw i64 %conv4, %conv2 |
| 53 | %sub = sub nsw i64 %conv, %mul |
| 54 | ret i64 %sub |
| 55 | } |
| 56 | |
| 57 | ; CHECK: msub $5, $4 |
| 58 | define i64 @msub3(i32 %a, i32 %b, i64 %c) nounwind readnone { |
| 59 | entry: |
| 60 | %conv = sext i32 %a to i64 |
| 61 | %conv3 = sext i32 %b to i64 |
| 62 | %mul = mul nsw i64 %conv3, %conv |
| 63 | %sub = sub nsw i64 %c, %mul |
| 64 | ret i64 %sub |
| 65 | } |