xref: /llvm-project/llvm/test/Transforms/InstCombine/pr41164.ll (revision 4ab40eca080965c65802710e39adbb78c4ce7bde)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3
4@wyhash64_x = global i64 0, align 8
5
6define i64 @_Z8wyhash64v() {
7; CHECK-LABEL: @_Z8wyhash64v(
8; CHECK-NEXT:    [[TMP1:%.*]] = load i64, ptr @wyhash64_x, align 8
9; CHECK-NEXT:    [[TMP2:%.*]] = add i64 [[TMP1]], 6971258582664805397
10; CHECK-NEXT:    store i64 [[TMP2]], ptr @wyhash64_x, align 8
11; CHECK-NEXT:    [[TMP3:%.*]] = zext i64 [[TMP2]] to i128
12; CHECK-NEXT:    [[TMP4:%.*]] = mul nuw i128 [[TMP3]], 11795372955171141389
13; CHECK-NEXT:    [[TMP5:%.*]] = lshr i128 [[TMP4]], 64
14; CHECK-NEXT:    [[DOTMASKED:%.*]] = and i128 [[TMP4]], 18446744073709551615
15; CHECK-NEXT:    [[TMP6:%.*]] = xor i128 [[TMP5]], [[DOTMASKED]]
16; CHECK-NEXT:    [[TMP7:%.*]] = mul nuw nsw i128 [[TMP6]], 1946526487930394057
17; CHECK-NEXT:    [[TMP8:%.*]] = lshr i128 [[TMP7]], 64
18; CHECK-NEXT:    [[TMP9:%.*]] = xor i128 [[TMP8]], [[TMP7]]
19; CHECK-NEXT:    [[TMP10:%.*]] = trunc i128 [[TMP9]] to i64
20; CHECK-NEXT:    ret i64 [[TMP10]]
21;
22  %1 = load i64, ptr @wyhash64_x, align 8
23  %2 = add i64 %1, 6971258582664805397
24  store i64 %2, ptr @wyhash64_x, align 8
25  %3 = zext i64 %2 to i128
26  %4 = mul i128 %3, 11795372955171141389
27  %5 = lshr i128 %4, 64
28  %6 = xor i128 %5, %4
29  %7 = trunc i128 %6 to i64
30  %8 = zext i64 %7 to i128
31  %9 = mul i128 %8, 1946526487930394057
32  %10 = lshr i128 %9, 64
33  %11 = xor i128 %10, %9
34  %12 = trunc i128 %11 to i64
35  ret i64 %12
36}
37