brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 9154171 Raw
62 lines · plain
1; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin -mcpu=generic | FileCheck %s2; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin -mcpu=atom | FileCheck -check-prefix=ATOM %s3; RUN: llc < %s -fast-isel -fast-isel-abort=3 -mtriple=x86_64 | FileCheck -check-prefix=ELF64 %s4 5@src = external dso_preemptable global i326 7; rdar://66531188define i32 @loadgv() nounwind {9entry:10	%0 = load i32, ptr @src, align 411	%1 = load i32, ptr @src, align 412        %2 = add i32 %0, %113        store i32 %2, ptr @src14	ret i32 %215; This should fold one of the loads into the add.16; CHECK-LABEL: loadgv:17; CHECK: 	movl	L_src$non_lazy_ptr, %eax18; CHECK: 	movl	(%eax), %eax19; CHECK: 	movl	L_src$non_lazy_ptr, %ecx20; CHECK: 	addl	(%ecx), %eax21; CHECK: 	movl	L_src$non_lazy_ptr, %ecx22; CHECK: 	movl	%eax, (%ecx)23; CHECK: 	ret24 25; ATOM:	loadgv:26; ATOM:	        movl    L_src$non_lazy_ptr, %eax27; ATOM:         movl    (%eax), %eax28; ATOM:	        movl    L_src$non_lazy_ptr, %ecx29; ATOM:         addl    (%ecx), %eax30; ATOM:	        movl    L_src$non_lazy_ptr, %ecx31; ATOM:         movl    %eax, (%ecx)32; ATOM:         ret33 34;; dso_preemptable src is loaded via GOT indirection.35; ELF64-LABEL: loadgv:36; ELF64:        movq    src@GOTPCREL(%rip), %rax37; ELF64-NEXT:   movl    (%rax), %eax38; ELF64-NEXT:   movq    src@GOTPCREL(%rip), %rcx39; ELF64-NEXT:   addl    (%rcx), %eax40; ELF64-NEXT:   movq    src@GOTPCREL(%rip), %rcx41; ELF64-NEXT:   movl    %eax, (%rcx)42; ELF64-NEXT:   retq43 44}45 46%stuff = type { ptr }47@LotsStuff = external constant [4 x ptr]48 49define void @t(ptr %this) nounwind {50entry:51	store ptr getelementptr ([4 x ptr], ptr @LotsStuff, i32 0, i32 2), ptr null, align 452	ret void53; CHECK: _t:54; CHECK:	xorl    %eax, %eax55; CHECK:	movl	L_LotsStuff$non_lazy_ptr, %ecx56 57; ATOM: _t:58; ATOM:         movl    L_LotsStuff$non_lazy_ptr, %e{{..}}59; ATOM:         xorl    %e{{..}}, %e{{..}}60 61}62