42 lines · plain
1; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-misched=false < %s | FileCheck %s2 3define i32 @fold64to32(i64 %add, i32 %spill) {4; CHECK-LABEL: fold64to32:5; CHECK: movq %rdi, -{{[0-9]+}}(%rsp) # 8-byte Spill6; CHECK: subl -{{[0-9]+}}(%rsp), %esi # 4-byte Folded Reload7entry:8 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"()9 %trunc = trunc i64 %add to i3210 %sub = sub i32 %spill, %trunc11 ret i32 %sub12}13 14define i8 @fold64to8(i64 %add, i8 %spill) {15; CHECK-LABEL: fold64to8:16; CHECK: movq %rdi, -{{[0-9]+}}(%rsp) # 8-byte Spill17; CHECK: subb -{{[0-9]+}}(%rsp), %sil # 1-byte Folded Reload18entry:19 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"()20 %trunc = trunc i64 %add to i821 %sub = sub i8 %spill, %trunc22 ret i8 %sub23}24 25; Do not fold a 4-byte store into a 8-byte spill slot26; CHECK-LABEL: nofold27; CHECK: movq %rsi, -{{[0-9]+}}(%rsp) # 8-byte Spill28; CHECK: movq -{{[0-9]+}}(%rsp), %rax # 8-byte Reload29; CHECK: subl %edi, %eax30; CHECK: movq %rax, -{{[0-9]+}}(%rsp) # 8-byte Spill31; CHECK: movq -{{[0-9]+}}(%rsp), %rax # 8-byte Reload32define i32 @nofold(i64 %add, i64 %spill) {33entry:34 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"()35 %trunc = trunc i64 %add to i3236 %truncspill = trunc i64 %spill to i3237 %sub = sub i32 %truncspill, %trunc38 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"()39 ret i32 %sub40}41 42