Michael Kuperstein | f221f13 | 2016-11-14 19:58:11 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=i686-unknown-linux-gnu -enable-misched=false < %s | FileCheck %s |
| 2 | |
| 3 | define fastcc i8 @fold32to8(i32 %add, i8 %spill) { |
| 4 | ; CHECK-LABEL: fold32to8: |
| 5 | ; CHECK: movl %ecx, (%esp) # 4-byte Spill |
Michael Kuperstein | 47eb85a | 2016-11-23 18:33:49 +0000 | [diff] [blame] | 6 | ; CHECK: subb (%esp), %dl # 1-byte Folded Reload |
Michael Kuperstein | f221f13 | 2016-11-14 19:58:11 +0000 | [diff] [blame] | 7 | entry: |
| 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 |
| 15 | define 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 |
| 20 | entry: |
| 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 | } |