File: bswap.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (93 lines) | stat: -rw-r--r-- 2,208 bytes parent folder | download | duplicates (13)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -passes=instsimplify | FileCheck %s

declare i16 @llvm.bswap.i16(i16)
declare <2 x i16> @llvm.bswap.v2i16(<2 x i16>)

define i1 @test1(i16 %arg) {
; CHECK-LABEL: @test1(
; CHECK-NEXT:    ret i1 false
;
  %a = or i16 %arg, 1
  %b = call i16 @llvm.bswap.i16(i16 %a)
  %res = icmp eq i16 %b, 0
  ret i1 %res
}

define i1 @test1v(<2 x i16> %arg) {
; CHECK-LABEL: @test1v(
; CHECK-NEXT:    ret i1 false
;
  %a = or <2 x i16> %arg, <i16 1, i16 0>
  %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
  %c = extractelement <2 x i16> %b, i32 0
  %res = icmp eq i16 %c, 0
  ret i1 %res
}

define i1 @test2(i16 %arg) {
; CHECK-LABEL: @test2(
; CHECK-NEXT:    ret i1 false
;
  %a = or i16 %arg, 1024
  %b = call i16 @llvm.bswap.i16(i16 %a)
  %res = icmp eq i16 %b, 0
  ret i1 %res
}

define i1 @test2v(<2 x i16> %arg) {
; CHECK-LABEL: @test2v(
; CHECK-NEXT:    ret i1 false
;
  %a = or <2 x i16> %arg, <i16 0, i16 1024>
  %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
  %c = extractelement <2 x i16> %b, i32 1
  %res = icmp eq i16 %c, 0
  ret i1 %res
}

define i1 @test3(i16 %arg) {
; CHECK-LABEL: @test3(
; CHECK-NEXT:    ret i1 false
;
  %a = and i16 %arg, 1
  %b = call i16 @llvm.bswap.i16(i16 %a)
  %and = and i16 %b, 1
  %res = icmp eq i16 %and, 1
  ret i1 %res
}

define i1 @test3v(<2 x i16> %arg) {
; CHECK-LABEL: @test3v(
; CHECK-NEXT:    ret i1 false
;
  %a = and <2 x i16> %arg, <i16 1, i16 -1>
  %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
  %c = extractelement <2 x i16> %b, i32 0
  %and = and i16 %c, 1
  %res = icmp eq i16 %and, 1
  ret i1 %res
}

define i1 @test4(i16 %arg) {
; CHECK-LABEL: @test4(
; CHECK-NEXT:    ret i1 false
;
  %a = and i16 %arg, 511
  %b = call i16 @llvm.bswap.i16(i16 %a)
  %and = and i16 %b, 256
  %res = icmp eq i16 %and, 1
  ret i1 %res
}

define i1 @test4v(<2 x i16> %arg) {
; CHECK-LABEL: @test4v(
; CHECK-NEXT:    ret i1 false
;
  %a = and <2 x i16> %arg, <i16 511, i16 511>
  %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
  %and = and <2 x i16> %b, <i16 255, i16 256>
  %ext = extractelement <2 x i16> %and, i32 1
  %res = icmp eq i16 %ext, 1
  ret i1 %res
}