1; RUN: llc < %s -O0 -fast-isel-abort -mtriple=arm64-apple-darwin | FileCheck %s 2 3; Test load/store of global value from global offset table. 4@seed = common global i64 0, align 8 5 6define void @Initrand() nounwind { 7entry: 8; CHECK: @Initrand 9; CHECK: adrp x[[REG:[0-9]+]], _seed@GOTPAGE 10; CHECK: ldr x[[REG2:[0-9]+]], [x[[REG]], _seed@GOTPAGEOFF] 11; CHECK: str x{{[0-9]+}}, [x[[REG2]]] 12 store i64 74755, i64* @seed, align 8 13 ret void 14} 15 16define i32 @Rand() nounwind { 17entry: 18; CHECK: @Rand 19; CHECK: adrp x[[REG:[0-9]+]], _seed@GOTPAGE 20; CHECK: ldr x[[REG2:[0-9]+]], [x[[REG]], _seed@GOTPAGEOFF] 21; CHECK: movz x[[REG3:[0-9]+]], #0x51d 22; CHECK: ldr x[[REG4:[0-9]+]], [x[[REG2]]] 23; CHECK: mul x[[REG5:[0-9]+]], x[[REG4]], x[[REG3]] 24; CHECK: movz x[[REG6:[0-9]+]], #0x3619 25; CHECK: add x[[REG7:[0-9]+]], x[[REG5]], x[[REG6]] 26; CHECK: orr x[[REG8:[0-9]+]], xzr, #0xffff 27; CHECK: and x[[REG9:[0-9]+]], x[[REG7]], x[[REG8]] 28; CHECK: str x[[REG9]], [x[[REG]]] 29; CHECK: ldr x{{[0-9]+}}, [x[[REG]]] 30 %0 = load i64* @seed, align 8 31 %mul = mul nsw i64 %0, 1309 32 %add = add nsw i64 %mul, 13849 33 %and = and i64 %add, 65535 34 store i64 %and, i64* @seed, align 8 35 %1 = load i64* @seed, align 8 36 %conv = trunc i64 %1 to i32 37 ret i32 %conv 38} 39