File: varargs-softfloat.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 (81 lines) | stat: -rw-r--r-- 3,052 bytes parent folder | download | duplicates (6)
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
; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s

%struct.__va_list_tag = type { i32, i32, i8*, i8* }

declare void @llvm.va_end(i8*) #0
declare void @llvm.va_start(i8*) #10

define void @hardf(i8* %fmt, ...) #1 {
; CHECK-LABEL: hardf
; When using XMM registers to pass floating-point parameters,
; we need to spill those for va_start.
; CHECK: testb %al, %al
; CHECK: movaps  %xmm0, {{.*}}%rsp
; CHECK: movaps  %xmm1, {{.*}}%rsp
; CHECK: movaps  %xmm2, {{.*}}%rsp
; CHECK: movaps  %xmm3, {{.*}}%rsp
; CHECK: movaps  %xmm4, {{.*}}%rsp
; CHECK: movaps  %xmm5, {{.*}}%rsp
; CHECK: movaps  %xmm6, {{.*}}%rsp
; CHECK: movaps  %xmm7, {{.*}}%rsp
  %va = alloca [1 x %struct.__va_list_tag], align 16
  %arraydecay = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %va, i64 0, i64 0
  %a = bitcast %struct.__va_list_tag* %arraydecay to i8*
  call void @llvm.va_start(i8* %a)
  call void @llvm.va_end(i8* nonnull %a)
  ret void
}

define void @softf(i8* %fmt, ...) #2 {
; CHECK-LABEL: softf
; For software floating point, floats are passed in general
; purpose registers, so no need to spill XMM registers.
; CHECK-NOT: %xmm
; CHECK: retq
  %va = alloca [1 x %struct.__va_list_tag], align 16
  %arraydecay = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %va, i64 0, i64 0
  %a = bitcast %struct.__va_list_tag* %arraydecay to i8*
  call void @llvm.va_start(i8* %a)
  call void @llvm.va_end(i8* nonnull %a)
  ret void
}

define void @noimplf(i8* %fmt, ...) #3 {
; CHECK-LABEL: noimplf
; Even with noimplicitfloat, when using the hardware float API, we
; need to emit code to spill the XMM registers (PR36507).
; CHECK: testb %al, %al
; CHECK: movaps  %xmm0, {{.*}}%rsp
; CHECK: movaps  %xmm1, {{.*}}%rsp
; CHECK: movaps  %xmm2, {{.*}}%rsp
; CHECK: movaps  %xmm3, {{.*}}%rsp
; CHECK: movaps  %xmm4, {{.*}}%rsp
; CHECK: movaps  %xmm5, {{.*}}%rsp
; CHECK: movaps  %xmm6, {{.*}}%rsp
; CHECK: movaps  %xmm7, {{.*}}%rsp
  %va = alloca [1 x %struct.__va_list_tag], align 16
  %arraydecay = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %va, i64 0, i64 0
  %a = bitcast %struct.__va_list_tag* %arraydecay to i8*
  call void @llvm.va_start(i8* %a)
  call void @llvm.va_end(i8* nonnull %a)
  ret void
}

define void @noimplsoftf(i8* %fmt, ...) #4 {
; CHECK-LABEL: noimplsoftf
; Combining noimplicitfloat and use-soft-float should not assert (PR48528).
; CHECK-NOT: %xmm
; CHECK: retq
  %va = alloca [1 x %struct.__va_list_tag], align 16
  %arraydecay = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %va, i64 0, i64 0
  %a = bitcast %struct.__va_list_tag* %arraydecay to i8*
  call void @llvm.va_start(i8* %a)
  call void @llvm.va_end(i8* nonnull %a)
  ret void
}

attributes #0 = { nounwind }
attributes #1 = { nounwind uwtable }
attributes #2 = { nounwind uwtable "use-soft-float"="true" }
attributes #3 = { noimplicitfloat nounwind uwtable }
attributes #4 = { noimplicitfloat nounwind uwtable "use-soft-float"="true" }