File: icmp-signmask.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,388 kB
  • sloc: cpp: 7,438,767; ansic: 1,393,871; asm: 1,012,926; python: 241,728; f90: 86,635; objc: 75,411; 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 (54 lines) | stat: -rw-r--r-- 1,771 bytes parent folder | download | duplicates (8)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s

define i1 @cmp_x_and_negp2_with_eq(i8 %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_eq(
; CHECK-NEXT:    [[R:%.*]] = icmp slt i8 [[X:%.*]], -126
; CHECK-NEXT:    ret i1 [[R]]
;
  %andx = and i8 %x, -2
  %r = icmp eq i8 %andx, 128
  ret i1 %r
}

define i1 @cmp_x_and_negp2_with_eq_fail_not_signmask(i8 %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_eq_fail_not_signmask(
; CHECK-NEXT:    [[ANDX:%.*]] = and i8 [[X:%.*]], -2
; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[ANDX]], -124
; CHECK-NEXT:    ret i1 [[R]]
;
  %andx = and i8 %x, -2
  %r = icmp eq i8 %andx, 132
  ret i1 %r
}

define <2 x i1> @cmp_x_and_negp2_with_ne(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne(
; CHECK-NEXT:    [[R:%.*]] = icmp sgt <2 x i8> [[X:%.*]], <i8 -121, i8 -113>
; CHECK-NEXT:    ret <2 x i1> [[R]]
;
  %andx = and <2 x i8> %x, <i8 -8, i8 -16>
  %r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
  ret <2 x i1> %r
}

define <2 x i1> @cmp_x_and_negp2_with_ne_or_z(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne_or_z(
; CHECK-NEXT:    [[R:%.*]] = icmp sge <2 x i8> [[X:%.*]], <i8 -128, i8 -112>
; CHECK-NEXT:    ret <2 x i1> [[R]]
;
  %andx = and <2 x i8> %x, <i8 0, i8 -16>
  %r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
  ret <2 x i1> %r
}

define <2 x i1> @cmp_x_and_negp2_with_ne_fail_not_p2(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne_fail_not_p2(
; CHECK-NEXT:    [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 -8, i8 -15>
; CHECK-NEXT:    [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], splat (i8 -128)
; CHECK-NEXT:    ret <2 x i1> [[R]]
;
  %andx = and <2 x i8> %x, <i8 -8, i8 -15>
  %r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
  ret <2 x i1> %r
}