From f3359807242e95f9e94bb35c0d90a73c794f1af0 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 13 Feb 2014 19:02:20 -0800 Subject: Preserve alignment information when splitting loads and stores. --- test/Transforms/NaCl/expand-i64.ll | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/Transforms/NaCl/expand-i64.ll b/test/Transforms/NaCl/expand-i64.ll index df4804d19b..fd468fc6d1 100644 --- a/test/Transforms/NaCl/expand-i64.ll +++ b/test/Transforms/NaCl/expand-i64.ll @@ -217,6 +217,21 @@ define i64 @load(i64 *%a) { ret i64 %c } +; CHECK: define i32 @aligned_load(i64* %a) { +; CHECK: %1 = ptrtoint i64* %a to i32 +; CHECK: %2 = inttoptr i32 %1 to i32* +; CHECK: %3 = load i32* %2, align 16 +; CHECK: %4 = add i32 %1, 4 +; CHECK: %5 = inttoptr i32 %4 to i32* +; CHECK: %6 = load i32* %5, align 4 +; CHECK: call void @setHigh32(i32 %6) +; CHECK: ret i32 %3 +; CHECK: } +define i64 @aligned_load(i64 *%a) { + %c = load i64* %a, align 16 + ret i64 %c +} + ; CHECK: define void @store(i64* %a, i32, i32) { ; CHECK: %3 = ptrtoint i64* %a to i32 ; CHECK: %4 = inttoptr i32 %3 to i32* @@ -231,6 +246,20 @@ define void @store(i64 *%a, i64 %b) { ret void } +; CHECK: define void @aligned_store(i64* %a, i32, i32) { +; CHECK: %3 = ptrtoint i64* %a to i32 +; CHECK: %4 = inttoptr i32 %3 to i32* +; CHECK: store i32 %0, i32* %4, align 16 +; CHECK: %5 = add i32 %3, 4 +; CHECK: %6 = inttoptr i32 %5 to i32* +; CHECK: store i32 %1, i32* %6, align 4 +; CHECK: ret void +; CHECK: } +define void @aligned_store(i64 *%a, i64 %b) { + store i64 %b, i64* %a, align 16 + ret void +} + ; CHECK: define i32 @call(i32, i32) { ; CHECK: %3 = call i32 @foo(i32 %0, i32 %1) ; CHECK: %4 = call i32 @getHigh32() -- cgit v1.2.3-18-g5258