File: calling-conv-windowed.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,245,064 kB
  • sloc: cpp: 7,619,731; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,676; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (103 lines) | stat: -rw-r--r-- 3,377 bytes parent folder | download | duplicates (3)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=xtensa -O1 -mattr=+windowed -verify-machineinstrs < %s \
; RUN:   | FileCheck %s -check-prefix=XTENSA

; Check placement of first 6 arguments in registers and 7th argument on stack
define dso_local i32 @test1(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d, i32 noundef %e, i32 noundef %f, ptr nocapture noundef readonly byval(i32) align 4 %p) {
; XTENSA-LABEL: test1:
; XTENSA:         .cfi_startproc
; XTENSA-NEXT:  # %bb.0:
; XTENSA-NEXT:    entry a1, 32
; XTENSA-NEXT:    .cfi_def_cfa_offset 32
; XTENSA-NEXT:    add a8, a7, a2
; XTENSA-NEXT:    l32i a9, a1, 32
; XTENSA-NEXT:    add a2, a8, a9
; XTENSA-NEXT:    retw
  %l = load i32, ptr %p, align 4
  %sum = add nsw i32 %f, %a
  %1 = add nsw i32 %sum, %l
  ret i32 %1
}

; Check placement of second i64 argument in registers
define dso_local i32 @test2(i32 noundef %a, i64 noundef %b, i32 noundef %c) {
; XTENSA-LABEL: test2:
; XTENSA:         .cfi_startproc
; XTENSA-NEXT:  # %bb.0:
; XTENSA-NEXT:    entry a1, 32
; XTENSA-NEXT:    .cfi_def_cfa_offset 32
; XTENSA-NEXT:    add a8, a6, a2
; XTENSA-NEXT:    add a2, a8, a4
; XTENSA-NEXT:    retw
  %tr = trunc i64 %b to i32
  %sum = add nsw i32 %c, %a
  %1 = add nsw i32 %sum, %tr
  ret i32 %1
}

; Check placement of first argument typeof i8 in register
define dso_local i32 @test3(i8 noundef signext %a, i64 noundef %b, i32 noundef %c) {
; XTENSA-LABEL: test3:
; XTENSA:         .cfi_startproc
; XTENSA-NEXT:  # %bb.0:
; XTENSA-NEXT:    entry a1, 32
; XTENSA-NEXT:    .cfi_def_cfa_offset 32
; XTENSA-NEXT:    add a8, a2, a6
; XTENSA-NEXT:    add a2, a8, a4
; XTENSA-NEXT:    retw
  %tr = trunc i64 %b to i32
  %se = sext i8 %a to i32
  %sum = add nsw i32 %se, %c
  %1 = add nsw i32 %sum, %tr
  ret i32 %1
}

; Check placement of 4th argument typeof i64 on stack
define dso_local i32 @test4(i8 noundef signext %a, i64 noundef %b, i32 noundef %c, ptr nocapture noundef readonly byval(i64) align 8 %p) {
; XTENSA-LABEL: test4:
; XTENSA:         .cfi_startproc
; XTENSA-NEXT:  # %bb.0:
; XTENSA-NEXT:    entry a1, 32
; XTENSA-NEXT:    .cfi_def_cfa_offset 32
; XTENSA-NEXT:    add a8, a2, a6
; XTENSA-NEXT:    add a8, a8, a4
; XTENSA-NEXT:    l32i a9, a1, 32
; XTENSA-NEXT:    add a2, a8, a9
; XTENSA-NEXT:    retw
  %l = load i64, ptr %p, align 8
  %tr1 = trunc i64 %b to i32
  %tr2 = trunc i64 %l to i32
  %se = sext i8 %a to i32
  %sum1 = add nsw i32 %se, %c
  %sum2 = add nsw i32 %sum1, %tr1
  %1 = add nsw i32 %sum2, %tr2
  ret i32 %1
}

; Check placement of 128 bit structure on registers
define dso_local i32 @test5([4 x i32] %a, i32 noundef %b) {
; XTENSA-LABEL: test5:
; XTENSA:         .cfi_startproc
; XTENSA-NEXT:  # %bb.0:
; XTENSA-NEXT:    entry a1, 32
; XTENSA-NEXT:    .cfi_def_cfa_offset 32
; XTENSA-NEXT:    add a2, a2, a6
; XTENSA-NEXT:    retw
  %ev = extractvalue [4 x i32] %a, 0
  %1 = add nsw i32 %ev, %b
  ret i32 %1
}

; Check placement of 128 bit structure on stack
define dso_local i32 @test6(i32 noundef %a, [4 x i32] %b) {
; XTENSA-LABEL: test6:
; XTENSA:         .cfi_startproc
; XTENSA-NEXT:  # %bb.0:
; XTENSA-NEXT:    entry a1, 32
; XTENSA-NEXT:    .cfi_def_cfa_offset 32
; XTENSA-NEXT:    add a2, a3, a2
; XTENSA-NEXT:    retw
  %ev = extractvalue [4 x i32] %b, 0
  %1 = add nsw i32 %ev, %a
  ret i32 %1
}