OLD | NEW |
---|---|
(Empty) | |
1 ; This file checks support for legalization in MIPS. | |
2 | |
3 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ | |
Jim Stichnoth
2016/10/13 17:15:29
Better to remove both instances of --need=allow_du
jaydeep.patil
2016/10/14 04:40:43
Done.
| |
4 ; RUN: --command %p2i --filetype=asm --assemble --disassemble \ | |
5 ; RUN: --target mips32 -i %s --args -O2 --skip-unimplemented \ | |
Jim Stichnoth
2016/10/13 17:15:30
If possible, remove --skip-unimplemented and -allo
jaydeep.patil
2016/10/14 04:40:43
Done.
We are also planning to remove --skip-unimpl
| |
6 ; RUN: -allow-externally-defined-symbols \ | |
7 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ | |
8 ; RUN: --command FileCheck --check-prefix MIPS32 %s | |
9 | |
10 define internal i32 @legalization(i32 %a, i32 %b, i32 %c, i32 %d, | |
11 i32 %e, i32 %f) { | |
12 entry: | |
13 %a.addr.i8 = alloca i8, i32 4, align 4 | |
14 %b.addr.i8 = alloca i8, i32 4, align 4 | |
15 %c.addr.i8 = alloca i8, i32 4, align 4 | |
16 %d.addr.i8 = alloca i8, i32 4, align 4 | |
17 %e.addr.i8 = alloca i8, i32 4, align 4 | |
18 %f.addr.i8 = alloca i8, i32 4, align 4 | |
19 %r1.i8 = alloca i8, i32 4, align 4 | |
20 %r2.i8 = alloca i8, i32 4, align 4 | |
21 %r3.i8 = alloca i8, i32 4, align 4 | |
22 %a.addr = bitcast i8* %a.addr.i8 to i32* | |
23 %b.addr = bitcast i8* %b.addr.i8 to i32* | |
24 %c.addr = bitcast i8* %c.addr.i8 to i32* | |
25 %d.addr = bitcast i8* %d.addr.i8 to i32* | |
26 %e.addr = bitcast i8* %e.addr.i8 to i32* | |
27 %f.addr = bitcast i8* %f.addr.i8 to i32* | |
28 %r1 = bitcast i8* %r1.i8 to i32* | |
29 %r2 = bitcast i8* %r2.i8 to i32* | |
30 %r3 = bitcast i8* %r3.i8 to i32* | |
31 store i32 %a, i32* %a.addr, align 1 | |
32 store i32 %b, i32* %b.addr, align 1 | |
33 store i32 %c, i32* %c.addr, align 1 | |
34 store i32 %d, i32* %d.addr, align 1 | |
35 store i32 %e, i32* %e.addr, align 1 | |
36 store i32 %f, i32* %f.addr, align 1 | |
37 %0 = load i32, i32* %a.addr, align 1 | |
38 %1 = load i32, i32* %f.addr, align 1 | |
39 %add1 = add nsw i32 %0, %1 | |
Jim Stichnoth
2016/10/13 17:15:29
"nsw" is not part of the PNaCl bitcode ABI, so tha
jaydeep.patil
2016/10/14 04:40:43
Done.
Used pydir/build-pnacl-ir.py script to gener
| |
40 store i32 %add1, i32* %r1, align 1 | |
41 %2 = load i32, i32* %b.addr, align 1 | |
42 %3 = load i32, i32* %e.addr, align 1 | |
43 %add2 = add nsw i32 %2, %3 | |
44 store i32 %add2, i32* %r2, align 1 | |
45 %4 = load i32, i32* %r1, align 1 | |
46 %5 = load i32, i32* %r2, align 1 | |
47 %add3 = add nsw i32 %4, %5 | |
48 store i32 %add3, i32* %r3, align 1 | |
49 %6 = load i32, i32* %r3, align 1 | |
50 ret i32 %6 | |
51 } | |
52 ; MIPS32-LABEL: legalization | |
53 ; MIPS32: addiu sp,sp,-48 | |
Jim Stichnoth
2016/10/13 17:15:29
I would be a bit cautious about assuming specific
jaydeep.patil
2016/10/14 04:40:43
Acknowledged.
The pre-colored registers (a0-a3 and
| |
54 ; MIPS32: lw [[ARG_E:.*]],64(sp) | |
55 ; MIPS32: lw [[ARG_F:.*]],68(sp) | |
56 ; MIPS32: sw a0,0(sp) | |
57 ; MIPS32: sw a1,4(sp) | |
58 ; MIPS32: sw a2,8(sp) | |
59 ; MIPS32: sw a3,12(sp) | |
60 ; MIPS32: sw [[ARG_E]],16(sp) | |
61 ; MIPS32: sw [[ARG_F]],20(sp) | |
62 ; MIPS32: lw [[TMP_A:.*]],0(sp) | |
63 ; MIPS32: lw [[TMP_F:.*]],20(sp) | |
64 ; MIPS32: addu [[ADD1:.*]],[[TMP_A]],[[TMP_F]] | |
65 ; MIPS32: sw [[ADD1]],24(sp) | |
66 ; MIPS32: lw [[TMP_B:.*]],4(sp) | |
67 ; MIPS32: lw [[TMP_E:.*]],16(sp) | |
68 ; MIPS32: addu [[ADD2:.*]],[[TMP_B]],[[TMP_E]] | |
69 ; MIPS32: sw [[ADD2]],28(sp) | |
70 ; MIPS32: lw [[TMP_ADD1:.*]],24(sp) | |
71 ; MIPS32: lw [[TMP_ADD2:.*]],28(sp) | |
72 ; MIPS32: addu [[ADD3:.*]],[[TMP_ADD1]],[[TMP_ADD2]] | |
73 ; MIPS32: sw [[ADD3]],32(sp) | |
74 ; MIPS32: lw v0,32(sp) | |
75 ; MIPS32: addiu sp,sp,48 | |
76 ; MIPS32: jr ra | |
OLD | NEW |