1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s
4 define i8 @inc8r(i8 noundef %a) {
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: incb %dil, %al
14 define i16 @inc16r(i16 noundef %a) {
15 ; CHECK-LABEL: inc16r:
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: incl %edi, %eax
18 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
25 define i32 @inc32r(i32 noundef %a) {
26 ; CHECK-LABEL: inc32r:
27 ; CHECK: # %bb.0: # %entry
28 ; CHECK-NEXT: incl %edi, %eax
35 define i64 @inc64r(i64 noundef %a) {
36 ; CHECK-LABEL: inc64r:
37 ; CHECK: # %bb.0: # %entry
38 ; CHECK-NEXT: incq %rdi, %rax
45 define i8 @inc8m(ptr %ptr) {
47 ; CHECK: # %bb.0: # %entry
48 ; CHECK-NEXT: incb (%rdi), %al
51 %a = load i8, ptr %ptr
56 define i16 @inc16m(ptr %ptr) {
57 ; CHECK-LABEL: inc16m:
58 ; CHECK: # %bb.0: # %entry
59 ; CHECK-NEXT: movzwl (%rdi), %eax
60 ; CHECK-NEXT: incl %eax
61 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
64 %a = load i16, ptr %ptr
69 define i32 @inc32m(ptr %ptr) {
70 ; CHECK-LABEL: inc32m:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK-NEXT: incl (%rdi), %eax
75 %a = load i32, ptr %ptr
80 define i64 @inc64m(ptr %ptr) {
81 ; CHECK-LABEL: inc64m:
82 ; CHECK: # %bb.0: # %entry
83 ; CHECK-NEXT: incq (%rdi), %rax
86 %a = load i64, ptr %ptr
91 define i8 @uinc8r(i8 noundef %a) {
92 ; CHECK-LABEL: uinc8r:
93 ; CHECK: # %bb.0: # %entry
94 ; CHECK-NEXT: incb %dil, %al
95 ; CHECK-NEXT: movzbl %al, %ecx
96 ; CHECK-NEXT: movl $255, %eax
97 ; CHECK-NEXT: cmovnel %ecx, %eax
98 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
101 %inc = call i8 @llvm.uadd.sat.i8(i8 %a, i8 1)
105 define i16 @uinc16r(i16 noundef %a) {
106 ; CHECK-LABEL: uinc16r:
107 ; CHECK: # %bb.0: # %entry
108 ; CHECK-NEXT: incw %di, %cx
109 ; CHECK-NEXT: movl $65535, %eax # imm = 0xFFFF
110 ; CHECK-NEXT: cmovnel %ecx, %eax
111 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
114 %inc = call i16 @llvm.uadd.sat.i16(i16 %a, i16 1)
118 define i32 @uinc32r(i32 noundef %a) {
119 ; CHECK-LABEL: uinc32r:
120 ; CHECK: # %bb.0: # %entry
121 ; CHECK-NEXT: incl %edi, %ecx
122 ; CHECK-NEXT: movl $-1, %eax
123 ; CHECK-NEXT: cmovnel %ecx, %eax
126 %inc = call i32 @llvm.uadd.sat.i32(i32 %a, i32 1)
130 define i64 @uinc64r(i64 noundef %a) {
131 ; CHECK-LABEL: uinc64r:
132 ; CHECK: # %bb.0: # %entry
133 ; CHECK-NEXT: incq %rdi, %rcx
134 ; CHECK-NEXT: movq $-1, %rax
135 ; CHECK-NEXT: cmovneq %rcx, %rax
138 %inc = call i64 @llvm.uadd.sat.i64(i64 %a, i64 1)
142 declare i8 @llvm.uadd.sat.i8(i8, i8)
143 declare i16 @llvm.uadd.sat.i16(i16, i16)
144 declare i32 @llvm.uadd.sat.i32(i32, i32)
145 declare i64 @llvm.uadd.sat.i64(i64, i64)
147 define void @inc8m_legacy(ptr %ptr) {
148 ; CHECK-LABEL: inc8m_legacy:
149 ; CHECK: # %bb.0: # %entry
150 ; CHECK-NEXT: incb (%rdi)
153 %a = load i8, ptr %ptr
155 store i8 %inc, ptr %ptr
159 define void @inc16m_legacy(ptr %ptr) {
160 ; CHECK-LABEL: inc16m_legacy:
161 ; CHECK: # %bb.0: # %entry
162 ; CHECK-NEXT: incw (%rdi)
165 %a = load i16, ptr %ptr
167 store i16 %inc, ptr %ptr
171 define void @inc32m_legacy(ptr %ptr) {
172 ; CHECK-LABEL: inc32m_legacy:
173 ; CHECK: # %bb.0: # %entry
174 ; CHECK-NEXT: incl (%rdi)
177 %a = load i32, ptr %ptr
179 store i32 %inc, ptr %ptr
183 define void @inc64m_legacy(ptr %ptr) {
184 ; CHECK-LABEL: inc64m_legacy:
185 ; CHECK: # %bb.0: # %entry
186 ; CHECK-NEXT: incq (%rdi)
189 %a = load i64, ptr %ptr
191 store i64 %inc, ptr %ptr