summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll
blob: b91457c79dea4914b16ab34994f35a171c241eab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s

define i1 @test1(i8 %x, i8 %y) {
; CHECK-LABEL: @test1(
; CHECK-NEXT:    [[TMP:%.*]] = icmp ult i8 %x, %y
; CHECK-NEXT:    ret i1 [[TMP]]
;
  %X = xor i8 %x, 128
  %Y = xor i8 %y, 128
  %tmp = icmp slt i8 %X, %Y
  ret i1 %tmp
}

define i1 @test2(i8 %x, i8 %y) {
; CHECK-LABEL: @test2(
; CHECK-NEXT:    [[TMP:%.*]] = icmp slt i8 %x, %y
; CHECK-NEXT:    ret i1 [[TMP]]
;
  %X = xor i8 %x, 128
  %Y = xor i8 %y, 128
  %tmp = icmp ult i8 %X, %Y
  ret i1 %tmp
}

define i1 @test3(i8 %x) {
; CHECK-LABEL: @test3(
; CHECK-NEXT:    [[TMP:%.*]] = icmp sgt i8 %x, -114
; CHECK-NEXT:    ret i1 [[TMP]]
;
  %X = xor i8 %x, 128
  %tmp = icmp uge i8 %X, 15
  ret i1 %tmp
}

define <2 x i1> @test3vec(<2 x i8> %x) {
; CHECK-LABEL: @test3vec(
; CHECK-NEXT:    [[TMP:%.*]] = icmp sgt <2 x i8> %x, <i8 -114, i8 -114>
; CHECK-NEXT:    ret <2 x i1> [[TMP]]
;
  %X = xor <2 x i8> %x, <i8 128, i8 128>
  %tmp = icmp uge <2 x i8> %X, <i8 15, i8 15>
  ret <2 x i1> %tmp
}

define i1 @test4(i8 %x, i8 %y) {
; CHECK-LABEL: @test4(
; CHECK-NEXT:    [[TMP:%.*]] = icmp ugt i8 %x, %y
; CHECK-NEXT:    ret i1 [[TMP]]
;
  %X = xor i8 %x, 127
  %Y = xor i8 %y, 127
  %tmp = icmp slt i8 %X, %Y
  ret i1 %tmp
}

define i1 @test5(i8 %x, i8 %y) {
; CHECK-LABEL: @test5(
; CHECK-NEXT:    [[TMP:%.*]] = icmp sgt i8 %x, %y
; CHECK-NEXT:    ret i1 [[TMP]]
;
  %X = xor i8 %x, 127
  %Y = xor i8 %y, 127
  %tmp = icmp ult i8 %X, %Y
  ret i1 %tmp
}

define i1 @test6(i8 %x) {
; CHECK-LABEL: @test6(
; CHECK-NEXT:    [[TMP:%.*]] = icmp slt i8 %x, 113
; CHECK-NEXT:    ret i1 [[TMP]]
;
  %X = xor i8 %x, 127
  %tmp = icmp uge i8 %X, 15
  ret i1 %tmp
}

define <2 x i1> @test6vec(<2 x i8> %x) {
; CHECK-LABEL: @test6vec(
; CHECK-NEXT:    [[TMP:%.*]] = icmp slt <2 x i8> %x, <i8 113, i8 113>
; CHECK-NEXT:    ret <2 x i1> [[TMP]]
;
  %X = xor <2 x i8> %x, <i8 127, i8 127>
  %tmp = icmp uge <2 x i8> %X, <i8 15, i8 15>
  ret <2 x i1> %tmp
}

OpenPOWER on IntegriCloud