1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-unknown \
3; RUN:   -mcpu=pwr9 | FileCheck %s
4; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-unknown \
5; RUN:   -mcpu=pwr9 -mattr=-altivec | FileCheck %s --check-prefix=NO-ALTIVEC
6
7declare i64 @llvm.bswap.i64(i64)
8
9define i64 @bswap64(i64 %x) {
10; CHECK-LABEL: bswap64:
11; CHECK:       # %bb.0: # %entry
12; CHECK-NEXT:    mtvsrdd 34, 3, 3
13; CHECK-NEXT:    xxbrd 0, 34
14; CHECK-NEXT:    mffprd 3, 0
15; CHECK-NEXT:    blr
16;
17; NO-ALTIVEC-LABEL: bswap64:
18; NO-ALTIVEC:       # %bb.0: # %entry
19; NO-ALTIVEC-NEXT:    rotldi 5, 3, 16
20; NO-ALTIVEC-NEXT:    rotldi 4, 3, 8
21; NO-ALTIVEC-NEXT:    rldimi 4, 5, 8, 48
22; NO-ALTIVEC-NEXT:    rotldi 5, 3, 24
23; NO-ALTIVEC-NEXT:    rldimi 4, 5, 16, 40
24; NO-ALTIVEC-NEXT:    rotldi 5, 3, 32
25; NO-ALTIVEC-NEXT:    rldimi 4, 5, 24, 32
26; NO-ALTIVEC-NEXT:    rotldi 5, 3, 48
27; NO-ALTIVEC-NEXT:    rldimi 4, 5, 40, 16
28; NO-ALTIVEC-NEXT:    rotldi 5, 3, 56
29; NO-ALTIVEC-NEXT:    rldimi 4, 5, 48, 8
30; NO-ALTIVEC-NEXT:    rldimi 4, 3, 56, 0
31; NO-ALTIVEC-NEXT:    mr 3, 4
32; NO-ALTIVEC-NEXT:    blr
33entry:
34  %0 = call i64 @llvm.bswap.i64(i64 %x)
35  ret i64 %0
36}
37
38