Chris Lattner | c7d855e | 2006-02-28 06:54:19 +0000 | [diff] [blame^] | 1 | |
| 2 | ; RUN: llvm-as < %s | llc -march=ppc32 && |
Chris Lattner | 7dd8b05 | 2005-09-02 00:13:56 +0000 | [diff] [blame] | 3 | ; RUN: llvm-as < %s | llc -march=ppc32 | not grep 'extsh\|rlwinm' |
Chris Lattner | c730706 | 2005-08-31 18:19:50 +0000 | [diff] [blame] | 4 | |
Chris Lattner | c7d855e | 2006-02-28 06:54:19 +0000 | [diff] [blame^] | 5 | declare short %foo() |
| 6 | |
Chris Lattner | c730706 | 2005-08-31 18:19:50 +0000 | [diff] [blame] | 7 | int %test1(short %X) { |
| 8 | %Y = cast short %X to int ;; dead |
| 9 | ret int %Y |
| 10 | } |
| 11 | |
| 12 | int %test2(ushort %X) { |
| 13 | %Y = cast ushort %X to int |
| 14 | %Z = and int %Y, 65535 ;; dead |
| 15 | ret int %Z |
| 16 | } |
Chris Lattner | 9832ce0 | 2005-09-01 23:43:58 +0000 | [diff] [blame] | 17 | |
| 18 | void %test3() { |
| 19 | %tmp.0 = call short %foo() ;; no extsh! |
| 20 | %tmp.1 = setlt short %tmp.0, 1234 |
| 21 | br bool %tmp.1, label %then, label %UnifiedReturnBlock |
| 22 | |
| 23 | then: |
| 24 | call int %test1(short 0) |
| 25 | ret void |
| 26 | UnifiedReturnBlock: |
| 27 | ret void |
| 28 | } |
| 29 | |
Chris Lattner | c7d855e | 2006-02-28 06:54:19 +0000 | [diff] [blame^] | 30 | uint %test4(ushort* %P) { |
| 31 | %tmp.1 = load ushort* %P |
| 32 | %tmp.2 = cast ushort %tmp.1 to uint |
| 33 | %tmp.3 = and uint %tmp.2, 255 |
| 34 | ret uint %tmp.3 |
| 35 | } |
| 36 | |
| 37 | uint %test5(short* %P) { |
| 38 | %tmp.1 = load short* %P |
| 39 | %tmp.2 = cast short %tmp.1 to ushort |
| 40 | %tmp.3 = cast ushort %tmp.2 to uint |
| 41 | %tmp.4 = and uint %tmp.3, 255 |
| 42 | ret uint %tmp.4 |
| 43 | } |
| 44 | |
| 45 | uint %test6(uint* %P) { |
| 46 | %tmp.1 = load uint* %P |
| 47 | %tmp.2 = and uint %tmp.1, 255 |
| 48 | ret uint %tmp.2 |
| 49 | } |
| 50 | |
| 51 | ushort %test7(float %a) { |
| 52 | %tmp.1 = cast float %a to ushort |
| 53 | ret ushort %tmp.1 |
| 54 | } |
| 55 | |