File: rv32xtheadbs.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (76 lines) | stat: -rw-r--r-- 2,069 bytes parent folder | download | duplicates (2)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
; RUN:   | FileCheck %s -check-prefixes=RV32I
; RUN: llc -mtriple=riscv32 -mattr=+xtheadbs -verify-machineinstrs < %s \
; RUN:   | FileCheck %s -check-prefixes=RV32XTHEADBS

define i32 @th_tst_i32(i32 %a) nounwind {
; RV32I-LABEL: th_tst_i32:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slli a0, a0, 26
; RV32I-NEXT:    srli a0, a0, 31
; RV32I-NEXT:    ret
;
; RV32XTHEADBS-LABEL: th_tst_i32:
; RV32XTHEADBS:       # %bb.0:
; RV32XTHEADBS-NEXT:    th.tst a0, a0, 5
; RV32XTHEADBS-NEXT:    ret
  %shr = lshr i32 %a, 5
  %and = and i32 %shr, 1
  ret i32 %and
}

define i64 @th_tst_i64(i64 %a) nounwind {
; RV32I-LABEL: th_tst_i64:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slli a0, a0, 26
; RV32I-NEXT:    srli a0, a0, 31
; RV32I-NEXT:    li a1, 0
; RV32I-NEXT:    ret
;
; RV32XTHEADBS-LABEL: th_tst_i64:
; RV32XTHEADBS:       # %bb.0:
; RV32XTHEADBS-NEXT:    th.tst a0, a0, 5
; RV32XTHEADBS-NEXT:    li a1, 0
; RV32XTHEADBS-NEXT:    ret
  %shr = lshr i64 %a, 5
  %and = and i64 %shr, 1
  ret i64 %and
}

define signext i32 @th_tst_i32_cmp(i32 signext %a) nounwind {
; RV32I-LABEL: th_tst_i32_cmp:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slli a0, a0, 26
; RV32I-NEXT:    srli a0, a0, 31
; RV32I-NEXT:    ret
;
; RV32XTHEADBS-LABEL: th_tst_i32_cmp:
; RV32XTHEADBS:       # %bb.0:
; RV32XTHEADBS-NEXT:    th.tst a0, a0, 5
; RV32XTHEADBS-NEXT:    ret
  %and = and i32 %a, 32
  %cmp = icmp ne i32 %and, 0
  %zext = zext i1 %cmp to i32
  ret i32 %zext
}

define i64 @th_tst_i64_cmp(i64 %a) nounwind {
; RV32I-LABEL: th_tst_i64_cmp:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slli a0, a0, 26
; RV32I-NEXT:    srli a0, a0, 31
; RV32I-NEXT:    li a1, 0
; RV32I-NEXT:    ret
;
; RV32XTHEADBS-LABEL: th_tst_i64_cmp:
; RV32XTHEADBS:       # %bb.0:
; RV32XTHEADBS-NEXT:    th.tst a0, a0, 5
; RV32XTHEADBS-NEXT:    li a1, 0
; RV32XTHEADBS-NEXT:    ret
  %and = and i64 %a, 32
  %cmp = icmp ne i64 %and, 0
  %zext = zext i1 %cmp to i64
  ret i64 %zext
}