File: bitreverse-fold.ll

package info (click to toggle)
llvm-toolchain-5.0 1:5.0.1-2~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 553,688 kB
  • sloc: cpp: 2,878,786; ansic: 584,110; asm: 246,252; python: 124,751; objc: 106,925; sh: 21,542; lisp: 8,628; pascal: 5,885; ml: 5,544; perl: 5,312; makefile: 2,208; cs: 2,022; xml: 686; php: 212; csh: 117
file content (110 lines) | stat: -rw-r--r-- 2,939 bytes parent folder | download
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
; RUN: opt < %s -instcombine -S | FileCheck %s

define i32 @identity_bitreverse_i32(i32 %p) {
; CHECK-LABEL: @identity_bitreverse_i32(
; CHECK-NEXT: ret i32 %p
  %a = call i32 @llvm.bitreverse.i32(i32 %p)
  %b = call i32 @llvm.bitreverse.i32(i32 %a)
  ret i32 %b
}

; CHECK-LABEL: @identity_bitreverse_v2i32(
; CHECK-NEXT: ret <2 x i32> %p
define <2 x i32> @identity_bitreverse_v2i32(<2 x i32> %p) {
  %a = call <2 x i32> @llvm.bitreverse.v2i32(<2 x i32> %p)
  %b = call <2 x i32> @llvm.bitreverse.v2i32(<2 x i32> %a)
  ret <2 x i32> %b
}

; CHECK-LABEL: @reverse_0_i32(
; CHECK-NEXT: ret i32 0
define i32 @reverse_0_i32() {
  %x = call i32 @llvm.bitreverse.i32(i32 0)
  ret i32 %x
}

; CHECK-LABEL: @reverse_1_i32(
; CHECK-NEXT: ret i32 -2147483648
define i32 @reverse_1_i32() {
  %x = call i32 @llvm.bitreverse.i32(i32 1)
  ret i32 %x
}

; CHECK-LABEL: @reverse_neg1_i32(
; CHECK-NEXT: ret i32 -1
define i32 @reverse_neg1_i32() {
  %x = call i32 @llvm.bitreverse.i32(i32 -1)
  ret i32 %x
}

; CHECK-LABEL: @reverse_undef_i32(
; CHECK-NEXT: ret i32 undef
define i32 @reverse_undef_i32() {
  %x = call i32 @llvm.bitreverse.i32(i32 undef)
  ret i32 %x
}

; CHECK-LABEL: @reverse_false_i1(
; CHECK-NEXT: ret i1 false
define i1 @reverse_false_i1() {
  %x = call i1 @llvm.bitreverse.i1(i1 false)
  ret i1 %x
}

; CHECK-LABEL: @reverse_true_i1(
; CHECK-NEXT: ret i1 true
define i1 @reverse_true_i1() {
  %x = call i1 @llvm.bitreverse.i1(i1 true)
  ret i1 %x
}

; CHECK-LABEL: @reverse_undef_i1(
; CHECK-NEXT: ret i1 undef
define i1 @reverse_undef_i1() {
  %x = call i1 @llvm.bitreverse.i1(i1 undef)
  ret i1 %x
}

; CHECK-LABEL: @reverse_false_v2i1(
; CHECK-NEXT: ret <2 x i1> zeroinitializer
define <2 x i1> @reverse_false_v2i1() {
  %x = call <2  x i1> @llvm.bitreverse.v2i1(<2 x i1> zeroinitializer)
  ret <2 x i1> %x
}

; CHECK-LABEL: @reverse_true_v2i1(
; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
define <2 x i1> @reverse_true_v2i1() {
  %x = call <2 x i1> @llvm.bitreverse.v2i1(<2 x i1> <i1 true, i1 true>)
  ret <2 x i1> %x
}

; CHECK-LABEL: @bitreverse_920_1234_v2i32(
; CHECK-NEXT: ret <2 x i32> <i32 432013312, i32 1260388352>
define <2 x i32> @bitreverse_920_1234_v2i32() {
  %x = call <2 x i32> @llvm.bitreverse.v2i32(<2 x i32> <i32 920, i32 1234>)
  ret <2 x i32> %x
}

; CHECK-LABEL: @reverse_100_i3(
; CHECK-NEXT: ret i3 1
define i3 @reverse_100_i3() {
  %x = call i3 @llvm.bitreverse.i3(i3 100)
  ret i3 %x
}

; CHECK-LABEL: @reverse_6_3_v2i3(
; CHECK-NEXT: ret <2 x i3> <i3 3, i3 -2>
define <2 x i3> @reverse_6_3_v2i3() {
  %x = call <2  x i3> @llvm.bitreverse.v2i3(<2 x i3> <i3 6, i3 3>)
  ret <2 x i3> %x
}

declare i1 @llvm.bitreverse.i1(i1) readnone
declare <2 x i1> @llvm.bitreverse.v2i1(<2 x i1>) readnone

declare i3 @llvm.bitreverse.i3(i3) readnone
declare <2 x i3> @llvm.bitreverse.v2i3(<2 x i3>) readnone

declare i32 @llvm.bitreverse.i32(i32) readnone
declare <2 x i32> @llvm.bitreverse.v2i32(<2 x i32>) readnone