1; RUN: llc -march=hexagon < %s | FileCheck %s 2 3; Check that a store with a proper addressing mode is selected for various 4; cases of storing an immediate value. 5 6 7@var_i8 = global [10 x i8] zeroinitializer, align 8 8 9; CHECK-LABEL: store_imm_i8: 10; CHECK: memb(r0+#0) = #-1 11define void @store_imm_i8(i8* %p) nounwind { 12 store i8 255, i8* %p, align 4 13 ret void 14} 15 16; CHECK-LABEL: store_rr_i8: 17; CHECK: [[RV:r[0-9]+]] = #255 18; CHECK: memb(r0+r1<<#0) = [[RV]] 19define void @store_rr_i8(i8* %p, i32 %x) nounwind { 20 %t0 = getelementptr i8, i8* %p, i32 %x 21 store i8 255, i8* %t0, align 4 22 ret void 23} 24 25; CHECK-LABEL: store_io_i8: 26; CHECK: [[RV:r[0-9]+]] = #255 27; CHECK: memb(r0+##var_i8) = [[RV]] 28define void @store_io_i8(i32 %x) nounwind { 29 %t0 = getelementptr [10 x i8], [10 x i8]* @var_i8, i32 0, i32 %x 30 store i8 255, i8* %t0, align 4 31 ret void 32} 33 34; CHECK-LABEL: store_ur_i8: 35; CHECK: [[RV:r[0-9]+]] = #255 36; CHECK: memb(r0<<#2+##var_i8) = [[RV]] 37define void @store_ur_i8(i32 %x) nounwind { 38 %t0 = shl i32 %x, 2 39 %t1 = getelementptr [10 x i8], [10 x i8]* @var_i8, i32 0, i32 %t0 40 store i8 255, i8* %t1, align 4 41 ret void 42} 43 44@var_i16 = global [10 x i16] zeroinitializer, align 8 45 46; CHECK-LABEL: store_imm_i16: 47; CHECK: memh(r0+#0) = #-1 48define void @store_imm_i16(i16* %p) nounwind { 49 store i16 65535, i16* %p, align 4 50 ret void 51} 52 53; CHECK-LABEL: store_rr_i16: 54; CHECK: [[RV:r[0-9]+]] = ##65535 55; CHECK: memh(r0+r1<<#1) = [[RV]] 56define void @store_rr_i16(i16* %p, i32 %x) nounwind { 57 %t0 = getelementptr i16, i16* %p, i32 %x 58 store i16 65535, i16* %t0, align 4 59 ret void 60} 61 62; CHECK-LABEL: store_ur_i16: 63; CHECK: [[RV:r[0-9]+]] = ##65535 64; CHECK: memh(r0<<#1+##var_i16) = [[RV]] 65define void @store_ur_i16(i32 %x) nounwind { 66 %t0 = getelementptr [10 x i16], [10 x i16]* @var_i16, i32 0, i32 %x 67 store i16 65535, i16* %t0, align 4 68 ret void 69} 70 71@var_i32 = global [10 x i32] zeroinitializer, align 8 72 73; CHECK-LABEL: store_imm_i32: 74; CHECK: memw(r0+#0) = #-1 75define void @store_imm_i32(i32* %p) nounwind { 76 store i32 4294967295, i32* %p, align 4 77 ret void 78} 79 80; CHECK-LABEL: store_rr_i32: 81; CHECK: [[RV:r[0-9]+]] = #-1 82; CHECK: memw(r0+r1<<#2) = [[RV]] 83define void @store_rr_i32(i32* %p, i32 %x) nounwind { 84 %t0 = getelementptr i32, i32* %p, i32 %x 85 store i32 4294967295, i32* %t0, align 4 86 ret void 87} 88 89; CHECK-LABEL: store_ur_i32: 90; CHECK: [[RV:r[0-9]+]] = #-1 91; CHECK: memw(r0<<#2+##var_i32) = [[RV]] 92define void @store_ur_i32(i32 %x) nounwind { 93 %t0 = getelementptr [10 x i32], [10 x i32]* @var_i32, i32 0, i32 %x 94 store i32 4294967295, i32* %t0, align 4 95 ret void 96} 97 98