1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
4 ; Check that multiple instances of 64-bit constants encodable as
5 ; 32-bit immediates are merged for code size savings.
7 ; Immediates with multiple users should not be pulled into instructions when
8 ; optimizing for code size.
9 define i1 @imm_multiple_users(i64 %a, i64* %b) optsize {
10 ; CHECK-LABEL: imm_multiple_users:
12 ; CHECK-NEXT: movq $-1, %rax
13 ; CHECK-NEXT: movq %rax, (%rsi)
14 ; CHECK-NEXT: cmpq %rax, %rdi
15 ; CHECK-NEXT: sete %al
17 store i64 -1, i64* %b, align 8
18 %cmp = icmp eq i64 %a, -1
22 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
24 ; Inlined memsets requiring multiple same-sized stores should be lowered using
25 ; the register, rather than immediate, form of stores when optimizing for
27 define void @memset_zero(i8* noalias nocapture %D) optsize {
28 ; CHECK-LABEL: memset_zero:
30 ; CHECK-NEXT: xorl %eax, %eax
31 ; CHECK-NEXT: movq %rax, 7(%rdi)
32 ; CHECK-NEXT: movq %rax, (%rdi)
34 tail call void @llvm.memset.p0i8.i64(i8* %D, i8 0, i64 15, i1 false)