1; Check that unaligned accesses are allowed in general. We check the 2; few exceptions (like CRL) in their respective test files. 3; 4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 5 6; Check that these four byte stores become a single word store. 7define void @f1(i8 *%ptr) { 8; CHECK: f1 9; CHECK: iilf [[REG:%r[0-5]]], 66051 10; CHECK: st [[REG]], 0(%r2) 11; CHECK: br %r14 12 %off1 = getelementptr i8, i8 *%ptr, i64 1 13 %off2 = getelementptr i8, i8 *%ptr, i64 2 14 %off3 = getelementptr i8, i8 *%ptr, i64 3 15 store i8 0, i8 *%ptr 16 store i8 1, i8 *%off1 17 store i8 2, i8 *%off2 18 store i8 3, i8 *%off3 19 ret void 20} 21 22; Check that unaligned 2-byte accesses are allowed. 23define i16 @f2(i16 *%src, i16 *%dst) { 24; CHECK-LABEL: f2: 25; CHECK: lh %r2, 0(%r2) 26; CHECK: sth %r2, 0(%r3) 27; CHECK: br %r14 28 %val = load i16, i16 *%src, align 1 29 store i16 %val, i16 *%dst, align 1 30 ret i16 %val 31} 32 33; Check that unaligned 4-byte accesses are allowed. 34define i32 @f3(i32 *%src1, i32 *%src2, i32 *%dst) { 35; CHECK-LABEL: f3: 36; CHECK: l %r2, 0(%r2) 37; CHECK: s %r2, 0(%r3) 38; CHECK: st %r2, 0(%r4) 39; CHECK: br %r14 40 %val1 = load i32, i32 *%src1, align 1 41 %val2 = load i32, i32 *%src2, align 2 42 %sub = sub i32 %val1, %val2 43 store i32 %sub, i32 *%dst, align 1 44 ret i32 %sub 45} 46 47; Check that unaligned 8-byte accesses are allowed. 48define i64 @f4(i64 *%src1, i64 *%src2, i64 *%dst) { 49; CHECK-LABEL: f4: 50; CHECK: lg %r2, 0(%r2) 51; CHECK: sg %r2, 0(%r3) 52; CHECK: stg %r2, 0(%r4) 53; CHECK: br %r14 54 %val1 = load i64, i64 *%src1, align 1 55 %val2 = load i64, i64 *%src2, align 2 56 %sub = sub i64 %val1, %val2 57 store i64 %sub, i64 *%dst, align 4 58 ret i64 %sub 59} 60