File: legalize-fneg.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (86 lines) | stat: -rw-r--r-- 2,220 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
77
78
79
80
81
82
83
84
85
86
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
; RUN:   | FileCheck -check-prefix=RV32 %s
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
; RUN:   | FileCheck -check-prefix=RV64 %s

define void @test1(ptr %a, ptr %b) nounwind {
; RV32-LABEL: test1:
; RV32:       # %bb.0: # %entry
; RV32-NEXT:    lw a1, 0(a1)
; RV32-NEXT:    lui a2, 524288
; RV32-NEXT:    xor a1, a1, a2
; RV32-NEXT:    sw a1, 0(a0)
; RV32-NEXT:    ret
;
; RV64-LABEL: test1:
; RV64:       # %bb.0: # %entry
; RV64-NEXT:    lw a1, 0(a1)
; RV64-NEXT:    lui a2, 524288
; RV64-NEXT:    xor a1, a1, a2
; RV64-NEXT:    sw a1, 0(a0)
; RV64-NEXT:    ret
entry:
  %0 = load float, ptr %b
  %neg = fneg float %0
  store float %neg, ptr %a
  ret void
}

define void @test2(ptr %a, ptr %b) nounwind {
; RV32-LABEL: test2:
; RV32:       # %bb.0: # %entry
; RV32-NEXT:    lw a2, 4(a1)
; RV32-NEXT:    lw a1, 0(a1)
; RV32-NEXT:    lui a3, 524288
; RV32-NEXT:    xor a2, a2, a3
; RV32-NEXT:    sw a1, 0(a0)
; RV32-NEXT:    sw a2, 4(a0)
; RV32-NEXT:    ret
;
; RV64-LABEL: test2:
; RV64:       # %bb.0: # %entry
; RV64-NEXT:    ld a1, 0(a1)
; RV64-NEXT:    li a2, -1
; RV64-NEXT:    slli a2, a2, 63
; RV64-NEXT:    xor a1, a1, a2
; RV64-NEXT:    sd a1, 0(a0)
; RV64-NEXT:    ret
entry:
  %0 = load double, ptr %b
  %neg = fneg double %0
  store double %neg, ptr %a
  ret void
}

define void @test3(ptr %a, ptr %b) nounwind {
; RV32-LABEL: test3:
; RV32:       # %bb.0: # %entry
; RV32-NEXT:    lw a2, 12(a1)
; RV32-NEXT:    lw a3, 0(a1)
; RV32-NEXT:    lw a4, 4(a1)
; RV32-NEXT:    lw a1, 8(a1)
; RV32-NEXT:    lui a5, 524288
; RV32-NEXT:    xor a2, a2, a5
; RV32-NEXT:    sw a3, 0(a0)
; RV32-NEXT:    sw a4, 4(a0)
; RV32-NEXT:    sw a1, 8(a0)
; RV32-NEXT:    sw a2, 12(a0)
; RV32-NEXT:    ret
;
; RV64-LABEL: test3:
; RV64:       # %bb.0: # %entry
; RV64-NEXT:    ld a2, 8(a1)
; RV64-NEXT:    ld a1, 0(a1)
; RV64-NEXT:    li a3, -1
; RV64-NEXT:    slli a3, a3, 63
; RV64-NEXT:    xor a2, a2, a3
; RV64-NEXT:    sd a1, 0(a0)
; RV64-NEXT:    sd a2, 8(a0)
; RV64-NEXT:    ret
entry:
  %0 = load fp128, ptr %b
  %neg = fneg fp128 %0
  store fp128 %neg, ptr %a
  ret void
}