File: float-arithmetic.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 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 (125 lines) | stat: -rw-r--r-- 3,264 bytes parent folder | download | duplicates (10)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -global-isel -o - \
; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s

define float @float_add(float %a, float %b) {
; CHECK-LABEL: float_add:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsaddsp f1, f1, f2
; CHECK-NEXT:    blr
entry:
  %add = fadd float %a, %b
  ret float %add
}

define double @double_add(double %a, double %b) {
; CHECK-LABEL: double_add:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsadddp f1, f1, f2
; CHECK-NEXT:    blr
entry:
  %add = fadd double %a, %b
  ret double %add
}

define float @float_sub(float %a, float %b) {
; CHECK-LABEL: float_sub:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xssubsp f1, f1, f2
; CHECK-NEXT:    blr
entry:
  %sub = fsub float %a, %b
  ret float %sub
}

define float @float_mul(float %a, float %b) {
; CHECK-LABEL: float_mul:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsmulsp f1, f1, f2
; CHECK-NEXT:    blr
entry:
  %mul = fmul float %a, %b
  ret float %mul
}

define float @float_div(float %a, float %b) {
; CHECK-LABEL: float_div:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsdivsp f1, f1, f2
; CHECK-NEXT:    blr
entry:
  %div = fdiv float %a, %b
  ret float %div
}

define <4 x float> @test_fadd_v4f32(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: test_fadd_v4f32:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvaddsp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fadd <4 x float> %a, %b
  ret <4 x float> %res
}

define <2 x double> @test_fadd_v2f64(<2 x double> %a, <2 x double> %b) {
; CHECK-LABEL: test_fadd_v2f64:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvadddp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fadd <2 x double> %a, %b
  ret <2 x double> %res
}

define <4 x float> @test_fsub_v4f32(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: test_fsub_v4f32:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvsubsp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fsub <4 x float> %a, %b
  ret <4 x float> %res
}

define <2 x double> @test_fsub_v2f64(<2 x double> %a, <2 x double> %b) {
; CHECK-LABEL: test_fsub_v2f64:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvsubdp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fsub <2 x double> %a, %b
  ret <2 x double> %res
}

define <4 x float> @test_fmul_v4f32(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: test_fmul_v4f32:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvmulsp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fmul <4 x float> %a, %b
  ret <4 x float> %res
}

define <2 x double> @test_fmul_v2f64(<2 x double> %a, <2 x double> %b) {
; CHECK-LABEL: test_fmul_v2f64:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvmuldp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fmul <2 x double> %a, %b
  ret <2 x double> %res
}

define <4 x float> @test_fdiv_v4f32(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: test_fdiv_v4f32:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvdivsp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fdiv <4 x float> %a, %b
  ret <4 x float> %res
}

define <2 x double> @test_fdiv_v2f64(<2 x double> %a, <2 x double> %b) {
; CHECK-LABEL: test_fdiv_v2f64:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xvdivdp v2, v2, v3
; CHECK-NEXT:    blr
  %res = fdiv <2 x double> %a, %b
  ret <2 x double> %res
}