File: fp_fneg.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 (68 lines) | stat: -rw-r--r-- 1,962 bytes parent folder | download | duplicates (7)
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
; RUN: llc < %s -mtriple=ve | FileCheck %s

;;; Test ‘fneg’ Instruction
;;;
;;; Syntax:
;;;   <result> = fneg [fast-math flags]* <ty> <op1>   ; yields ty:result
;;;
;;; Overview:
;;;    The ‘fneg’ instruction returns the negation of its operand.
;;;
;;; Arguments:
;;;   The argument to the ‘fneg’ instruction must be a floating-point or
;;;   vector of floating-point values.
;;;
;;; Semantics:
;;;
;;;   The value produced is a copy of the operand with its sign bit flipped.
;;;   This instruction can also take any number of fast-math flags, which are
;;;   optimization hints to enable otherwise unsafe floating-point
;;;   optimizations.
;;;
;;; Example:
;;;   <result> = fneg float %val          ; yields float:result = -%var
;;;
;;; Note:
;;;   We test only float/double/fp128.

; Function Attrs: norecurse nounwind readnone
define float @fneg_float(float %0) {
; CHECK-LABEL: fneg_float:
; CHECK:       # %bb.0:
; CHECK-NEXT:    sra.l %s0, %s0, 32
; CHECK-NEXT:    lea %s1, -2147483648
; CHECK-NEXT:    and %s1, %s1, (32)0
; CHECK-NEXT:    xor %s0, %s0, %s1
; CHECK-NEXT:    sll %s0, %s0, 32
; CHECK-NEXT:    b.l.t (, %s10)
  %2 = fneg float %0
  ret float %2
}

; Function Attrs: norecurse nounwind readnone
define double @fneg_double(double %0) {
; CHECK-LABEL: fneg_double:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xor %s0, %s0, (1)1
; CHECK-NEXT:    b.l.t (, %s10)
  %2 = fneg double %0
  ret double %2
}

; Function Attrs: norecurse nounwind readnone
define fp128 @fneg_quad(fp128 %0) {
; CHECK-LABEL: fneg_quad:
; CHECK:       .LBB{{[0-9]+}}_2:
; CHECK-NEXT:    st %s1, (, %s11)
; CHECK-NEXT:    st %s0, 8(, %s11)
; CHECK-NEXT:    ld1b.zx %s0, 15(, %s11)
; CHECK-NEXT:    lea %s1, 128
; CHECK-NEXT:    xor %s0, %s0, %s1
; CHECK-NEXT:    st1b %s0, 15(, %s11)
; CHECK-NEXT:    ld %s1, (, %s11)
; CHECK-NEXT:    ld %s0, 8(, %s11)
; CHECK-NEXT:    adds.l %s11, 16, %s11
; CHECK-NEXT:    b.l.t (, %s10)
  %2 = fneg fp128 %0
  ret fp128 %2
}