; Pin: a call to one of libgcc.s's hand-written helpers (multiply, ; divide, shift, memcpy / memmove / memset) is a JSLlight, which clobbers ; A, X, Y and $F0 only -- the helpers never touch IMG0..IMG7 ($D0..$DE). ; Values live across it stay in those words: here the pointer's high half ; stays in $D0 instead of moving to callee-saved $C0, which costs a save ; in the prologue and a restore before the return. ; ; RUN: llc -mtriple=w65816 -O2 < %s | FileCheck %s ; RUN: env W65816_DISABLE_LIGHT_CALLS=1 llc -mtriple=w65816 -O2 < %s | FileCheck %s --check-prefix=OFF target datalayout = "e-m:e-p:32:16-i16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16" define i16 @sumProducts(ptr %p, ptr %q, i16 %n) { ; CHECK-LABEL: sumProducts: ; CHECK-NOT: 0xc0 ; CHECK: stx 0xd0 ; CHECK-NOT: 0xc0 ; CHECK: jsl __mulhi3 ; CHECK-NOT: 0xc0 ; CHECK: rtl ; OFF-LABEL: sumProducts: ; OFF: lda 0xc0 ; OFF: stx 0xc0 ; OFF: jsl __mulhi3 ; OFF: sta 0xc0 ; OFF: rtl entry: br label %loop loop: %i = phi i16 [ 0, %entry ], [ %i1, %loop ] %s = phi i16 [ 0, %entry ], [ %s1, %loop ] %pa = getelementptr inbounds i16, ptr %p, i16 %i %qa = getelementptr inbounds i16, ptr %q, i16 %i %a = load i16, ptr %pa, align 2 %b = load i16, ptr %qa, align 2 %m = mul i16 %a, %b %s1 = add i16 %s, %m %i1 = add i16 %i, 1 %e = icmp eq i16 %i1, %n br i1 %e, label %done, label %loop done: ret i16 %s1 }