Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: test/MC/Mips/nacl-long-branch.ll

Issue 27690005: [MIPS] Modify LongBranch expansion to work with sandboxing (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Update. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 ; RUN: llc -filetype=obj -sfi-load -sfi-store -sfi-stack -sfi-branch -sfi-data \
2 ; RUN: -force-mips-long-branch -O3 -mtriple mipsel-none-nacl %s -o - \
Mark Seaborn 2013/10/24 23:38:43 Can you indent these continuation lines for readab
petarj 2013/11/21 18:23:42 Done.
3 ; RUN: | llvm-objdump -triple mipsel -disassemble -no-show-raw-insn - \
4 ; RUN: | FileCheck %s
5
6
7 declare void @f()
8
9 define void @long_branch(i32 %arg) {
10 entry:
11 %cmp = icmp eq i32 %arg, 0
12 br i1 %cmp, label %if.then, label %if.end
13 if.then:
14 tail call void @f()
15 br label %if.end
16 if.end:
17 ret void
18 }
19
20 ; This file tests that MipsLongBranchPass works with sandboxing.
21 ; The nonsandboxed code of the previous function is:
22
23 ; long_branch:
24 ; 0: lui $2, 0
25 ; 4: addiu $2, $2, 0
26 ; 8: addiu $sp, $sp, -24
27 ; c: sw $ra, 20($sp)
28 ; 10: bne $4, $zero, 20
Mark Seaborn 2013/10/24 23:38:43 Might it be useful to add CHECKs for this case too
petarj 2013/11/21 18:23:42 Done.
29 ; 14: addu $gp, $2, $25
30 ; 18: lw $25, 0($gp)
31 ; 1c: jalr $25
32 ; 20: nop
33 ; 24: lw $ra, 20($sp)
34 ; 28: addiu $sp, $sp, 24
35 ; 2c: jr $ra
36 ; 30: nop
37
38 ; We pass -force-mips-long-branch option to llc to make sure that bne
39 ; instruction is expanded into long branch. We specifically test that
40 ; in the expanded sandboxed long branch sequence the offset that LUi/ADDiu
Mark Seaborn 2013/10/24 23:38:43 Can you add a comment explaining the arithmetic fo
petarj 2013/11/21 18:23:42 Done.
41 ; instructions create is the correct offset from the ADDiu instruction to the
42 ; branch target (which is lw $ra, 20($sp) in this case).
43
44 ; 0: lui $2, 0
45 ; 4: addiu $2, $2, 0
46 ; 8: addiu $sp, $sp, -24
47 ; c: and $sp, $sp, $15
48 ; 10: sw $ra, 20($sp)
49 ; 14: beq $4, $zero, 80
50 ; 18: addu $gp, $2, $25
51 ; 1c: nop
52 ; 20: addiu $sp, $sp, -8
53 ; 24: and $sp, $sp, $15
54 ; 28: sw $ra, 0($sp)
55 ; 2c: nop
56 ; 30: nop
57 ; 34: nop
58 ; CHECK: 38: bal 8
59 ; CHECK-NEXT: 3c: lui $1, 0
60 ; CHECK-NEXT: 40: addiu $1, $1, 64
61 ; 44: addu $1, $ra, $1
62 ; 48: lw $ra, 0($sp)
63 ; 4c: nop
64 ; 50: addiu $sp, $sp, 8
65 ; 54: and $sp, $sp, $15
66 ; 58: and $1, $1, $14
67 ; 5c: jr $1
Mark Seaborn 2013/10/24 23:38:43 The instructions from "bal 8" down to here are par
petarj 2013/11/21 18:23:42 Done.
68 ; 60: nop
69 ; 64: and $gp, $gp, $15
70 ; 68: lw $25, 0($gp)
71 ; 6c: nop
72 ; 70: nop
73 ; 74: and $25, $25, $14
74 ; 78: jalr $25
75 ; 7c: nop
76 ; CHECK: 80: lw $ra, 20($sp)
77 ; 84: addiu $sp, $sp, 24
78 ; 88: and $sp, $sp, $15
79 ; 8c: nop
80 ; 90: and $ra, $ra, $14
81 ; 94: jr $ra
82 ; 98: nop
83
OLDNEW
« lib/Target/Mips/MipsMCInstLower.h ('K') | « lib/Target/Mips/MipsMCInstLower.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698