File: memop-scalar-x32.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 (111 lines) | stat: -rw-r--r-- 2,952 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
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --no_x86_scrub_sp
; RUN: llc -mtriple=i386-linux-gnu                       -global-isel -verify-machineinstrs < %s | FileCheck %s
; RUN: llc -mtriple=i386-linux-gnu -regbankselect-greedy -global-isel -verify-machineinstrs < %s | FileCheck %s

;TODO merge with x86-64 tests (many operations not suppored yet)

define i1 @test_load_i1(i1 * %p1) {
; CHECK-LABEL: test_load_i1:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %eax
; CHECK-NEXT:    movb (%eax), %al
; CHECK-NEXT:    retl
  %r = load i1, i1* %p1
  ret i1 %r
}

define i8 @test_load_i8(i8 * %p1) {
; CHECK-LABEL: test_load_i8:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %eax
; CHECK-NEXT:    movb (%eax), %al
; CHECK-NEXT:    retl
  %r = load i8, i8* %p1
  ret i8 %r
}

define i16 @test_load_i16(i16 * %p1) {
; CHECK-LABEL: test_load_i16:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %eax
; CHECK-NEXT:    movzwl (%eax), %eax
; CHECK-NEXT:    retl
  %r = load i16, i16* %p1
  ret i16 %r
}

define i32 @test_load_i32(i32 * %p1) {
; CHECK-LABEL: test_load_i32:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %eax
; CHECK-NEXT:    movl (%eax), %eax
; CHECK-NEXT:    retl
  %r = load i32, i32* %p1
  ret i32 %r
}

define i1 * @test_store_i1(i1 %val, i1 * %p1) {
; CHECK-LABEL: test_store_i1:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %ecx
; CHECK-NEXT:    movl 8(%esp), %eax
; CHECK-NEXT:    andb $1, %cl
; CHECK-NEXT:    movb %cl, (%eax)
; CHECK-NEXT:    retl
  store i1 %val, i1* %p1
  ret i1 * %p1;
}

define i8 * @test_store_i8(i8 %val, i8 * %p1) {
; CHECK-LABEL: test_store_i8:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %ecx
; CHECK-NEXT:    movl 8(%esp), %eax
; CHECK-NEXT:    movb %cl, (%eax)
; CHECK-NEXT:    retl
  store i8 %val, i8* %p1
  ret i8 * %p1;
}

define i16 * @test_store_i16(i16 %val, i16 * %p1) {
; CHECK-LABEL: test_store_i16:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %ecx
; CHECK-NEXT:    movl 8(%esp), %eax
; CHECK-NEXT:    movw %cx, (%eax)
; CHECK-NEXT:    retl
  store i16 %val, i16* %p1
  ret i16 * %p1;
}

define i32 * @test_store_i32(i32 %val, i32 * %p1) {
; CHECK-LABEL: test_store_i32:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %ecx
; CHECK-NEXT:    movl 8(%esp), %eax
; CHECK-NEXT:    movl %ecx, (%eax)
; CHECK-NEXT:    retl
  store i32 %val, i32* %p1
  ret i32 * %p1;
}

define i32* @test_load_ptr(i32** %ptr1) {
; CHECK-LABEL: test_load_ptr:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %eax
; CHECK-NEXT:    movl (%eax), %eax
; CHECK-NEXT:    retl
  %p = load i32*, i32** %ptr1
  ret i32* %p
}

define void @test_store_ptr(i32** %ptr1, i32* %a) {
; CHECK-LABEL: test_store_ptr:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl 4(%esp), %eax
; CHECK-NEXT:    movl 8(%esp), %ecx
; CHECK-NEXT:    movl %ecx, (%eax)
; CHECK-NEXT:    retl
  store i32* %a, i32** %ptr1
  ret void
}