File: neg-abs.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (70 lines) | stat: -rw-r--r-- 2,357 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
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -ppc-asm-full-reg-names -verify-machineinstrs \
; RUN:   -mtriple=powerpc64le-linux-gnu < %s | FileCheck \
; RUN:   -check-prefix=CHECK-LE %s

declare i64 @llvm.abs.i64(i64, i1 immarg)
declare <2 x i64> @llvm.abs.v2i64(<2 x i64>, i1)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1)
declare <8 x i16> @llvm.abs.v8i16(<8 x i16>, i1)
declare <16 x i8> @llvm.abs.v16i8(<16 x i8>, i1)

define i64@neg_abs(i64 %x) {
; CHECK-LE-LABEL: neg_abs:
; CHECK-LE:       # %bb.0:
; CHECK-LE-NEXT:    sradi r4, r3, 63
; CHECK-LE-NEXT:    xor r3, r3, r4
; CHECK-LE-NEXT:    sub r3, r4, r3
; CHECK-LE-NEXT:    blr
  %abs = tail call i64 @llvm.abs.i64(i64 %x, i1 true)
  %neg = sub nsw i64 0, %abs
  ret i64 %neg
}

define <2 x i64> @neg_abs_v2i64(<2 x i64> %0) {
; CHECK-LE-LABEL: neg_abs_v2i64:
; CHECK-LE:       # %bb.0:
; CHECK-LE-NEXT:    xxlxor vs35, vs35, vs35
; CHECK-LE-NEXT:    vsubudm v3, v3, v2
; CHECK-LE-NEXT:    vminsd v2, v2, v3
; CHECK-LE-NEXT:    blr
  %abs = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %0, i1 true)
  %neg.abs = sub <2 x i64> zeroinitializer, %abs
  ret <2 x i64> %neg.abs
}

define <4 x i32> @neg_abs_v4i32(<4 x i32> %0) {
; CHECK-LE-LABEL: neg_abs_v4i32:
; CHECK-LE:       # %bb.0:
; CHECK-LE-NEXT:    xxlxor vs35, vs35, vs35
; CHECK-LE-NEXT:    vsubuwm v3, v3, v2
; CHECK-LE-NEXT:    vminsw v2, v2, v3
; CHECK-LE-NEXT:    blr
  %abs = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %0, i1 true)
  %neg.abs = sub <4 x i32> zeroinitializer, %abs
  ret <4 x i32> %neg.abs
}

define <8 x i16> @neg_abs_v8i16(<8 x i16> %0) {
; CHECK-LE-LABEL: neg_abs_v8i16:
; CHECK-LE:       # %bb.0:
; CHECK-LE-NEXT:    xxlxor vs35, vs35, vs35
; CHECK-LE-NEXT:    vsubuhm v3, v3, v2
; CHECK-LE-NEXT:    vminsh v2, v2, v3
; CHECK-LE-NEXT:    blr
  %abs = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %0, i1 true)
  %neg.abs = sub <8 x i16> zeroinitializer, %abs
  ret <8 x i16> %neg.abs
}

define <16 x i8> @neg_abs_v16i8(<16 x i8> %0) {
; CHECK-LE-LABEL: neg_abs_v16i8:
; CHECK-LE:       # %bb.0:
; CHECK-LE-NEXT:    xxlxor vs35, vs35, vs35
; CHECK-LE-NEXT:    vsububm v3, v3, v2
; CHECK-LE-NEXT:    vminsb v2, v2, v3
; CHECK-LE-NEXT:    blr
  %abs = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %0, i1 true)
  %neg.abs = sub <16 x i8> zeroinitializer, %abs
  ret <16 x i8> %neg.abs
}