Nate Begeman | feca19b | 2005-09-01 00:04:03 +0000 | [diff] [blame] | 1 | ; All of these ands and shifts should be folded into rlwimi's |
Reid Spencer | eb1d74e | 2007-04-16 17:36:08 +0000 | [diff] [blame] | 2 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -o %t -f |
| 3 | ; RUN: not grep mulhwu %t |
| 4 | ; RUN: not grep srawi %t |
| 5 | ; RUN: not grep add %t |
Dan Gohman | 28beeea | 2007-08-15 13:36:28 +0000 | [diff] [blame^] | 6 | ; RUN: grep mulhw %t | count 1 |
Nate Begeman | feca19b | 2005-09-01 00:04:03 +0000 | [diff] [blame] | 7 | |
| 8 | implementation ; Functions: |
| 9 | |
| 10 | int %mulhs(int %a, int %b) { |
| 11 | entry: |
| 12 | %tmp.1 = cast int %a to ulong ; <ulong> [#uses=1] |
| 13 | %tmp.3 = cast int %b to ulong ; <ulong> [#uses=1] |
| 14 | %tmp.4 = mul ulong %tmp.3, %tmp.1 ; <ulong> [#uses=1] |
| 15 | %tmp.6 = shr ulong %tmp.4, ubyte 32 ; <ulong> [#uses=1] |
| 16 | %tmp.7 = cast ulong %tmp.6 to int ; <int> [#uses=1] |
| 17 | ret int %tmp.7 |
| 18 | } |