blob: aa0d5b6d1b76327a4f58d878dd7972aa69768242 [file] [log] [blame]
Reid Spencer69ccadd2006-12-02 04:23:10 +00001; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 &&
2; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep 'extsh\|rlwinm'
Chris Lattnerc7307062005-08-31 18:19:50 +00003
Reid Spencereacb7022006-12-31 06:02:00 +00004declare short @sext %foo()
Chris Lattnerc7d855e2006-02-28 06:54:19 +00005
Reid Spencereacb7022006-12-31 06:02:00 +00006int %test1(short @sext %X) {
Chris Lattnerc7307062005-08-31 18:19:50 +00007 %Y = cast short %X to int ;; dead
8 ret int %Y
9}
10
Reid Spencereacb7022006-12-31 06:02:00 +000011int %test2(ushort @zext %X) {
Chris Lattnerc7307062005-08-31 18:19:50 +000012 %Y = cast ushort %X to int
13 %Z = and int %Y, 65535 ;; dead
14 ret int %Z
15}
Chris Lattner9832ce02005-09-01 23:43:58 +000016
17void %test3() {
18 %tmp.0 = call short %foo() ;; no extsh!
19 %tmp.1 = setlt short %tmp.0, 1234
20 br bool %tmp.1, label %then, label %UnifiedReturnBlock
21
22then:
23 call int %test1(short 0)
24 ret void
25UnifiedReturnBlock:
26 ret void
27}
28
Chris Lattnerc7d855e2006-02-28 06:54:19 +000029uint %test4(ushort* %P) {
30 %tmp.1 = load ushort* %P
31 %tmp.2 = cast ushort %tmp.1 to uint
32 %tmp.3 = and uint %tmp.2, 255
33 ret uint %tmp.3
34}
35
36uint %test5(short* %P) {
37 %tmp.1 = load short* %P
38 %tmp.2 = cast short %tmp.1 to ushort
39 %tmp.3 = cast ushort %tmp.2 to uint
40 %tmp.4 = and uint %tmp.3, 255
41 ret uint %tmp.4
42}
43
44uint %test6(uint* %P) {
45 %tmp.1 = load uint* %P
46 %tmp.2 = and uint %tmp.1, 255
47 ret uint %tmp.2
48}
49
Reid Spencereacb7022006-12-31 06:02:00 +000050ushort @zext %test7(float %a) {
Chris Lattnerc7d855e2006-02-28 06:54:19 +000051 %tmp.1 = cast float %a to ushort
52 ret ushort %tmp.1
53}