source: icGREP/icgrep-devel/llvm-3.8.0.src/test/CodeGen/Hexagon/cmp-promote.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 1.6 KB
Line 
1; RUN: llc -march=hexagon < %s | FileCheck %s
2;
3; Bug 6714. Use sign-extend to promote the arguments for compare
4; equal/not-equal for 8- and 16-bit types with negative constants.
5
6; CHECK: cmp.eq{{.*}}#-16
7define i32 @foo1(i16 signext %q) nounwind readnone {
8entry:
9  %not.cmp = icmp ne i16 %q, -16
10  %res.0 = zext i1 %not.cmp to i32
11  ret i32 %res.0
12}
13
14; CHECK: cmp.eq{{.*}}#-14
15define i32 @foo2(i16 signext %q) nounwind readnone {
16entry:
17  %cmp = icmp eq i16 %q, -14
18  %res.0 = select i1 %cmp, i32 2, i32 0
19  ret i32 %res.0
20}
21
22; CHECK: cmp.eq{{.*}}#-8
23define i32 @foo3(i8 signext %r) nounwind readnone {
24entry:
25  %cmp = icmp eq i8 %r, -8
26  %res.0 = select i1 %cmp, i32 0, i32 3
27  ret i32 %res.0
28}
29
30; CHECK: cmp.eq{{.*}}#-6
31define i32 @foo4(i8 signext %r) nounwind readnone {
32entry:
33  %cmp = icmp eq i8 %r, -6
34  %res.0 = select i1 %cmp, i32 4, i32 0
35  ret i32 %res.0
36}
37
38; CHECK: cmp.eq{{.*}}#-20
39define i32 @foo5(i32 %s) nounwind readnone {
40entry:
41  %cmp = icmp eq i32 %s, -20
42  %res.0 = select i1 %cmp, i32 0, i32 5
43  ret i32 %res.0
44}
45
46; CHECK: cmp.eq{{.*}}#-18
47define i32 @foo6(i32 %s) nounwind readnone {
48entry:
49  %cmp = icmp eq i32 %s, -18
50  %res.0 = select i1 %cmp, i32 6, i32 0
51  ret i32 %res.0
52}
53
54; CHECK: cmp.eq{{.*}}#10
55define i32 @foo7(i16 signext %q) nounwind readnone {
56entry:
57  %cmp = icmp eq i16 %q, 10
58  %res.0 = select i1 %cmp, i32 7, i32 0
59  ret i32 %res.0
60}
61
62@g = external global i16
63
64; CHECK: cmp.eq{{.*}}#-12
65define i32 @foo8() nounwind readonly {
66entry:
67  %0 = load i16, i16* @g, align 2
68  %cmp = icmp eq i16 %0, -12
69  %res.0 = select i1 %cmp, i32 0, i32 8
70  ret i32 %res.0
71}
72
Note: See TracBrowser for help on using the repository browser.