1 ; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s 2 ; Check that we generate load instructions with global + offset 3 4 %struct.struc = type { i8, i8, i16, i32 } 5 6 @foo = common global %struct.struc zeroinitializer, align 4 7 8 define void @loadWord(i32 %val1, i32 %val2, i32* nocapture %ival) nounwind { 9 ; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memw(##foo{{ *}}+{{ *}}4) 10 entry: 11 %cmp = icmp sgt i32 %val1, %val2 12 br i1 %cmp, label %if.then, label %if.end 13 14 if.then: ; preds = %entry 15 %0 = load i32* getelementptr inbounds (%struct.struc* @foo, i32 0, i32 3), align 4 16 store i32 %0, i32* %ival, align 4 17 br label %if.end 18 19 if.end: ; preds = %if.then, %entry 20 ret void 21 } 22 23 define void @loadByte(i32 %val1, i32 %val2, i8* nocapture %ival) nounwind { 24 ; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memb(##foo{{ *}}+{{ *}}1) 25 entry: 26 %cmp = icmp sgt i32 %val1, %val2 27 br i1 %cmp, label %if.then, label %if.end 28 29 if.then: ; preds = %entry 30 %0 = load i8* getelementptr inbounds (%struct.struc* @foo, i32 0, i32 1), align 1 31 store i8 %0, i8* %ival, align 1 32 br label %if.end 33 34 if.end: ; preds = %if.then, %entry 35 ret void 36 } 37 38 define void @loadHWord(i32 %val1, i32 %val2, i16* %ival) nounwind { 39 ; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memh(##foo{{ *}}+{{ *}}2) 40 entry: 41 %cmp = icmp sgt i32 %val1, %val2 42 br i1 %cmp, label %if.then, label %if.end 43 44 if.then: ; preds = %entry 45 %0 = load i16* getelementptr inbounds (%struct.struc* @foo, i32 0, i32 2), align 2 46 store i16 %0, i16* %ival, align 2 47 br label %if.end 48 49 if.end: ; preds = %if.then, %entry 50 ret void 51 } 52