blob: 7fc1ed3521e9d8e73f36521b31e4bbbb3eddcbaf [file] [log] [blame]
Michael Kupersteinf221f132016-11-14 19:58:11 +00001; RUN: llc -mtriple=i686-unknown-linux-gnu -enable-misched=false < %s | FileCheck %s
2
3define fastcc i8 @fold32to8(i32 %add, i8 %spill) {
4; CHECK-LABEL: fold32to8:
5; CHECK: movl %ecx, (%esp) # 4-byte Spill
Michael Kuperstein47eb85a2016-11-23 18:33:49 +00006; CHECK: subb (%esp), %dl # 1-byte Folded Reload
Michael Kupersteinf221f132016-11-14 19:58:11 +00007entry:
8 tail call void asm sideeffect "", "~{eax},~{ebx},~{ecx},~{edi},~{esi},~{ebp},~{dirflag},~{fpsr},~{flags}"()
9 %trunc = trunc i32 %add to i8
10 %sub = sub i8 %spill, %trunc
11 ret i8 %sub
12}
13
14; Do not fold a 1-byte store into a 4-byte spill slot
15define fastcc i8 @nofold(i32 %add, i8 %spill) {
16; CHECK-LABEL: nofold:
17; CHECK: movl %edx, (%esp) # 4-byte Spill
18; CHECK: movl (%esp), %eax # 4-byte Reload
19; CHECK: subb %cl, %al
20entry:
21 tail call void asm sideeffect "", "~{eax},~{ebx},~{edx},~{edi},~{esi},~{ebp},~{dirflag},~{fpsr},~{flags}"()
22 %trunc = trunc i32 %add to i8
23 %sub = sub i8 %spill, %trunc
24 ret i8 %sub
25}