File: rotl.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 (36 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (19)
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
; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s

define i64 @func1(i64 %a, i32 %b) {
; CHECK-LABEL: func1:
; CHECK:       # %bb.0:
; CHECK-NEXT:    sll %s2, %s0, %s1
; CHECK-NEXT:    lea %s3, 64
; CHECK-NEXT:    subs.w.sx %s1, %s3, %s1
; CHECK-NEXT:    srl %s0, %s0, %s1
; CHECK-NEXT:    or %s0, %s0, %s2
; CHECK-NEXT:    b.l.t (, %s10)
  %b64 = zext i32 %b to i64
  %a.sl = shl i64 %a, %b64
  %b.inv = sub nsw i32 64, %b
  %b.inv64 = zext i32 %b.inv to i64
  %a.sr = lshr i64 %a, %b.inv64
  %r = or i64 %a.sr, %a.sl
  ret i64 %r
}

define i32 @func2(i32 %a, i32 %b) {
; CHECK-LABEL: func2:
; CHECK:       # %bb.0:
; CHECK-NEXT:    sla.w.sx %s2, %s0, %s1
; CHECK-NEXT:    subs.w.sx %s1, 32, %s1
; CHECK-NEXT:    and %s0, %s0, (32)0
; CHECK-NEXT:    srl %s0, %s0, %s1
; CHECK-NEXT:    or %s0, %s0, %s2
; CHECK-NEXT:    b.l.t (, %s10)
  %a.sl = shl i32 %a, %b
  %b.inv = sub nsw i32 32, %b
  %a.sr = lshr i32 %a, %b.inv
  %r = or i32 %a.sr, %a.sl
  ret i32 %r
}