brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 4208a15 Raw
71 lines · plain
1; RUN: llc < %s -mtriple=avr -mattr=movw,lpm | FileCheck %s2; XFAIL: *3 4; Tests the standard LPM instruction5 6define i8 @test8(ptr addrspace(1) %p) {7; CHECK-LABEL: test8:8; CHECK: movw r30, r249; CHECK: lpm r24, Z10  %1 = load i8, ptr addrspace(1) %p11  ret i8 %112}13 14define i16 @test16(ptr addrspace(1) %p) {15; CHECK-LABEL: test16:16; CHECK: movw r30, r2417; CHECK: lpm r24, Z+18; CHECK: lpm r25, Z+19  %1 = load i16, ptr addrspace(1) %p20  ret i16 %121}22 23define i8 @test8postinc(ptr addrspace(1) %x, i8 %y) {24; CHECK-LABEL: test8postinc:25; CHECK: movw r30, r2426; CHECK: lpm {{.*}}, Z+27entry:28  %cmp10 = icmp sgt i8 %y, 029  br i1 %cmp10, label %for.body, label %for.end30 31for.body:                                         ; preds = %entry, %for.body32  %ret.013 = phi i8 [ %add, %for.body ], [ 0, %entry ]33  %i.012 = phi i8 [ %inc, %for.body ], [ 0, %entry ]34  %x.addr.011 = phi ptr addrspace(1) [ %incdec.ptr, %for.body ], [ %x, %entry ]35  %incdec.ptr = getelementptr inbounds i8, ptr addrspace(1) %x.addr.011, i16 136  %0 = load i8, ptr addrspace(1) %x.addr.01137  %add = add i8 %0, %ret.01338  %inc = add i8 %i.012, 139  %exitcond = icmp eq i8 %inc, %y40  br i1 %exitcond, label %for.end, label %for.body41 42for.end:                                          ; preds = %for.body, %entry43  %ret.0.lcssa = phi i8 [ 0, %entry ], [ %add, %for.body ]44  ret i8 %ret.0.lcssa45}46 47define i16 @test16postinc(ptr addrspace(1) %x, i8 %y) {48; CHECK-LABEL: test16postinc:49; CHECK: movw r30, r2450; CHECK: lpm {{.*}}, Z+51; CHECK: lpm {{.*}}, Z+52entry:53  %cmp5 = icmp sgt i8 %y, 054  br i1 %cmp5, label %for.body, label %for.end55 56for.body:                                         ; preds = %entry, %for.body57  %ret.08 = phi i16 [ %add, %for.body ], [ 0, %entry ]58  %i.07 = phi i8 [ %inc, %for.body ], [ 0, %entry ]59  %x.addr.06 = phi ptr addrspace(1) [ %incdec.ptr, %for.body ], [ %x, %entry ]60  %incdec.ptr = getelementptr inbounds i16, ptr addrspace(1) %x.addr.06, i16 161  %0 = load i16, ptr addrspace(1) %x.addr.0662  %add = add nsw i16 %0, %ret.0863  %inc = add i8 %i.07, 164  %exitcond = icmp eq i8 %inc, %y65  br i1 %exitcond, label %for.end, label %for.body66 67for.end:                                          ; preds = %for.body, %entry68  %ret.0.lcssa = phi i16 [ 0, %entry ], [ %add, %for.body ]69  ret i16 %ret.0.lcssa70}71