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

Side by Side Diff: test/Transforms/NaCl/promote-i1-ops.ll

Issue 1151093004: Changes from 3.7 merge to files not in upstream (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 7 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
1 ; RUN: opt %s -nacl-promote-i1-ops -S | FileCheck %s 1 ; RUN: opt %s -nacl-promote-i1-ops -S | FileCheck %s
2 2
3 ; Test that the PromoteI1Ops pass expands out i1 loads/stores and i1 3 ; Test that the PromoteI1Ops pass expands out i1 loads/stores and i1
4 ; comparison and arithmetic operations, with the exception of "and", 4 ; comparison and arithmetic operations, with the exception of "and",
5 ; "or" and "xor". 5 ; "or" and "xor".
6 6
7 7
8 ; i1 loads and stores are converted to i8 load and stores with 8 ; i1 loads and stores are converted to i8 load and stores with
9 ; explicit casts. 9 ; explicit casts.
10 10
11 define i1 @load(i1* %ptr) { 11 define i1 @load(i1* %ptr) {
12 %val = load i1* %ptr 12 %val = load i1, i1* %ptr
13 ret i1 %val 13 ret i1 %val
14 } 14 }
15 ; CHECK: define i1 @load 15 ; CHECK: define i1 @load
16 ; CHECK-NEXT: %ptr.i8ptr = bitcast i1* %ptr to i8* 16 ; CHECK-NEXT: %ptr.i8ptr = bitcast i1* %ptr to i8*
17 ; CHECK-NEXT: %val.pre_trunc = load i8* %ptr.i8ptr 17 ; CHECK-NEXT: %val.pre_trunc = load i8, i8* %ptr.i8ptr
18 ; CHECK-NEXT: %val = trunc i8 %val.pre_trunc to i1 18 ; CHECK-NEXT: %val = trunc i8 %val.pre_trunc to i1
19 19
20 define void @store(i1 %val, i1* %ptr) { 20 define void @store(i1 %val, i1* %ptr) {
21 store i1 %val, i1* %ptr 21 store i1 %val, i1* %ptr
22 ret void 22 ret void
23 } 23 }
24 ; CHECK: define void @store 24 ; CHECK: define void @store
25 ; CHECK-NEXT: %ptr.i8ptr = bitcast i1* %ptr to i8* 25 ; CHECK-NEXT: %ptr.i8ptr = bitcast i1* %ptr to i8*
26 ; CHECK-NEXT: %val.expand_i1_val = zext i1 %val to i8 26 ; CHECK-NEXT: %val.expand_i1_val = zext i1 %val to i8
27 ; CHECK-NEXT: store i8 %val.expand_i1_val, i8* %ptr.i8ptr 27 ; CHECK-NEXT: store i8 %val.expand_i1_val, i8* %ptr.i8ptr
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 ; CHECK: define void @bitwise_ops 60 ; CHECK: define void @bitwise_ops
61 ; CHECK-NEXT: %and = and i1 %x, %y 61 ; CHECK-NEXT: %and = and i1 %x, %y
62 ; CHECK-NEXT: %or = or i1 %x, %y 62 ; CHECK-NEXT: %or = or i1 %x, %y
63 ; CHECK-NEXT: %xor = xor i1 %x, %y 63 ; CHECK-NEXT: %xor = xor i1 %x, %y
64 64
65 65
66 define void @unchanged_cases(i32 %x, i32 %y, i32* %ptr) { 66 define void @unchanged_cases(i32 %x, i32 %y, i32* %ptr) {
67 %add = add i32 %x, %y 67 %add = add i32 %x, %y
68 %cmp = icmp slt i32 %x, %y 68 %cmp = icmp slt i32 %x, %y
69 %val = load i32* %ptr 69 %val = load i32, i32* %ptr
70 store i32 %x, i32* %ptr 70 store i32 %x, i32* %ptr
71 ret void 71 ret void
72 } 72 }
73 ; CHECK: define void @unchanged_cases 73 ; CHECK: define void @unchanged_cases
74 ; CHECK-NEXT: %add = add i32 %x, %y 74 ; CHECK-NEXT: %add = add i32 %x, %y
75 ; CHECK-NEXT: %cmp = icmp slt i32 %x, %y 75 ; CHECK-NEXT: %cmp = icmp slt i32 %x, %y
76 ; CHECK-NEXT: %val = load i32* %ptr 76 ; CHECK-NEXT: %val = load i32, i32* %ptr
77 ; CHECK-NEXT: store i32 %x, i32* %ptr 77 ; CHECK-NEXT: store i32 %x, i32* %ptr
78 78
79 define void @i1_switch(i1 %a) { 79 define void @i1_switch(i1 %a) {
80 entry: 80 entry:
81 switch i1 %a, label %impossible [ 81 switch i1 %a, label %impossible [
82 i1 true, label %truedest 82 i1 true, label %truedest
83 i1 false, label %falsedest 83 i1 false, label %falsedest
84 ] 84 ]
85 85
86 impossible: 86 impossible:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 unreachable 134 unreachable
135 } 135 }
136 ; CHECK-LABEL: define void @i1_switch_default_false(i1 %a) 136 ; CHECK-LABEL: define void @i1_switch_default_false(i1 %a)
137 ; CHECK-LABEL: entry: 137 ; CHECK-LABEL: entry:
138 ; CHECK-NEXT: br i1 %a, label %truedest, label %falsedest 138 ; CHECK-NEXT: br i1 %a, label %truedest, label %falsedest
139 ; CHECK-LABEL: truedest: 139 ; CHECK-LABEL: truedest:
140 ; CHECK-NEXT: unreachable 140 ; CHECK-NEXT: unreachable
141 ; CHECK-LABEL: falsedest: 141 ; CHECK-LABEL: falsedest:
142 ; CHECK-NEXT: unreachable 142 ; CHECK-NEXT: unreachable
143 143
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698