1 ; RUN: llc -march=hexagon < %s | FileCheck %s
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.
6 ; CHECK: cmp.eq{{.*}}#-16
7 define i32 @foo1(i16 signext %q) nounwind readnone {
9 %not.cmp = icmp ne i16 %q, -16
10 %res.0 = zext i1 %not.cmp to i32
14 ; CHECK: cmp.eq{{.*}}#-14
15 define i32 @foo2(i16 signext %q) nounwind readnone {
17 %cmp = icmp eq i16 %q, -14
18 %res.0 = select i1 %cmp, i32 2, i32 0
22 ; CHECK: cmp.eq{{.*}}#-8
23 define i32 @foo3(i8 signext %r) nounwind readnone {
25 %cmp = icmp eq i8 %r, -8
26 %res.0 = select i1 %cmp, i32 0, i32 3
30 ; CHECK: cmp.eq{{.*}}#-6
31 define i32 @foo4(i8 signext %r) nounwind readnone {
33 %cmp = icmp eq i8 %r, -6
34 %res.0 = select i1 %cmp, i32 4, i32 0
38 ; CHECK: cmp.eq{{.*}}#-20
39 define i32 @foo5(i32 %s) nounwind readnone {
41 %cmp = icmp eq i32 %s, -20
42 %res.0 = select i1 %cmp, i32 0, i32 5
46 ; CHECK: cmp.eq{{.*}}#-18
47 define i32 @foo6(i32 %s) nounwind readnone {
49 %cmp = icmp eq i32 %s, -18
50 %res.0 = select i1 %cmp, i32 6, i32 0
54 ; CHECK: cmp.eq{{.*}}#10
55 define i32 @foo7(i16 signext %q) nounwind readnone {
57 %cmp = icmp eq i16 %q, 10
58 %res.0 = select i1 %cmp, i32 7, i32 0
62 @g = external global i16
64 ; CHECK: cmp.eq{{.*}}#-12
65 define i32 @foo8() nounwind readonly {
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