File: subnuw-with-xor.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (118 lines) | stat: -rw-r--r-- 3,551 bytes parent folder | download | duplicates (6)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s

define i8 @xor_w_sub_fail_missing_nuw(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @xor_w_sub_fail_missing_nuw(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[XOR:%.*]] = xor i8 [[X]], 15
; CHECK-NEXT:    [[R:%.*]] = sub nsw i8 15, [[XOR]]
; CHECK-NEXT:    ret i8 [[R]]
;
  %xor = xor i8 %x, 15
  %r = sub nsw i8 15, %xor
  ret i8 %r
}

define i8 @xor_w_sub_fail_diff_values(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @xor_w_sub_fail_diff_values(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[XOR:%.*]] = xor i8 [[X]], 15
; CHECK-NEXT:    [[R:%.*]] = sub nuw nsw i8 31, [[XOR]]
; CHECK-NEXT:    ret i8 [[R]]
;
  %xor = xor i8 %x, 15
  %r = sub nsw nuw i8 31, %xor
  ret i8 %r
}

define i8 @xor_w_sub_fail_diff_values2(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @xor_w_sub_fail_diff_values2(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[XOR:%.*]] = xor i8 [[X]], 31
; CHECK-NEXT:    [[R:%.*]] = sub nuw nsw i8 15, [[XOR]]
; CHECK-NEXT:    ret i8 [[R]]
;
  %xor = xor i8 %x, 31
  %r = sub nsw nuw i8 15, %xor
  ret i8 %r
}

define i8 @xor_w_sub_fail_not_mask(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @xor_w_sub_fail_not_mask(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[XOR:%.*]] = xor i8 [[X]], 30
; CHECK-NEXT:    [[R:%.*]] = sub nuw nsw i8 30, [[XOR]]
; CHECK-NEXT:    ret i8 [[R]]
;
  %xor = xor i8 %x, 30
  %r = sub nsw nuw i8 30, %xor
  ret i8 %r
}

define i8 @xor_w_sub_okay(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @xor_w_sub_okay(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    ret i8 [[X]]
;
  %xor = xor i8 %x, 31
  %r = sub nsw nuw i8 31, %xor
  ret i8 %r
}

define i8 @sub_w_xor_fail_missing_nuw(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @sub_w_xor_fail_missing_nuw(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[SUB:%.*]] = sub nsw i8 15, [[X]]
; CHECK-NEXT:    [[R:%.*]] = xor i8 [[SUB]], 15
; CHECK-NEXT:    ret i8 [[R]]
;
  %sub = sub nsw i8 15, %x
  %r = xor i8 %sub, 15
  ret i8 %r
}

define i8 @sub_w_xor_fail_diff_values(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @sub_w_xor_fail_diff_values(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[SUB:%.*]] = sub nuw nsw i8 15, [[X]]
; CHECK-NEXT:    [[R:%.*]] = xor i8 [[SUB]], 31
; CHECK-NEXT:    ret i8 [[R]]
;
  %sub = sub nsw nuw i8 15, %x
  %r = xor i8 %sub, 31
  ret i8 %r
}

define i8 @sub_w_sub_fail_diff_values2(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @sub_w_sub_fail_diff_values2(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[SUB:%.*]] = sub nuw nsw i8 31, [[X]]
; CHECK-NEXT:    [[R:%.*]] = xor i8 [[SUB]], 15
; CHECK-NEXT:    ret i8 [[R]]
;
  %sub = sub nsw nuw i8 31, %x
  %r = xor i8 %sub, 15
  ret i8 %r
}

define i8 @sub_w_sub_fail_not_mask(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @sub_w_sub_fail_not_mask(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    [[SUB:%.*]] = sub nuw nsw i8 30, [[X]]
; CHECK-NEXT:    [[R:%.*]] = xor i8 [[SUB]], 30
; CHECK-NEXT:    ret i8 [[R]]
;
  %sub = sub nsw nuw i8 30, %x
  %r = xor i8 %sub, 30
  ret i8 %r
}

define i8 @sub_w_sub_okay(i8 range(i8 0, 16) %x) {
; CHECK-LABEL: define i8 @sub_w_sub_okay(
; CHECK-SAME: i8 range(i8 0, 16) [[X:%.*]]) {
; CHECK-NEXT:    ret i8 [[X]]
;
  %sub = sub nsw nuw i8 31, %x
  %r = xor i8 %sub, 31
  ret i8 %r
}