xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/bswap-inline-asm.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck -check-prefix CHK %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; CHK-NOT: InlineAsm
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo:
7*9880d681SAndroid Build Coastguard Worker; CHECK: bswapq
8*9880d681SAndroid Build Coastguard Workerdefine i64 @foo(i64 %x) nounwind {
9*9880d681SAndroid Build Coastguard Worker	%asmtmp = tail call i64 asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
10*9880d681SAndroid Build Coastguard Worker	ret i64 %asmtmp
11*9880d681SAndroid Build Coastguard Worker}
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: bar:
14*9880d681SAndroid Build Coastguard Worker; CHECK: bswapq
15*9880d681SAndroid Build Coastguard Workerdefine i64 @bar(i64 %x) nounwind {
16*9880d681SAndroid Build Coastguard Worker	%asmtmp = tail call i64 asm "bswapq ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
17*9880d681SAndroid Build Coastguard Worker	ret i64 %asmtmp
18*9880d681SAndroid Build Coastguard Worker}
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: pen:
21*9880d681SAndroid Build Coastguard Worker; CHECK: bswapl
22*9880d681SAndroid Build Coastguard Workerdefine i32 @pen(i32 %x) nounwind {
23*9880d681SAndroid Build Coastguard Worker	%asmtmp = tail call i32 asm "bswapl ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %x) nounwind
24*9880d681SAndroid Build Coastguard Worker	ret i32 %asmtmp
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: s16:
28*9880d681SAndroid Build Coastguard Worker; CHECK: rolw    $8,
29*9880d681SAndroid Build Coastguard Workerdefine zeroext i16 @s16(i16 zeroext %x) nounwind {
30*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i16 asm "rorw $$8, ${0:w}", "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}"(i16 %x) nounwind
31*9880d681SAndroid Build Coastguard Worker  ret i16 %asmtmp
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t16:
35*9880d681SAndroid Build Coastguard Worker; CHECK: rolw    $8,
36*9880d681SAndroid Build Coastguard Workerdefine zeroext i16 @t16(i16 zeroext %x) nounwind {
37*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i16 asm "rorw $$8, ${0:w}", "=r,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i16 %x) nounwind
38*9880d681SAndroid Build Coastguard Worker  ret i16 %asmtmp
39*9880d681SAndroid Build Coastguard Worker}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: u16:
42*9880d681SAndroid Build Coastguard Worker; CHECK: rolw    $8,
43*9880d681SAndroid Build Coastguard Workerdefine zeroext i16 @u16(i16 zeroext %x) nounwind {
44*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i16 asm "rolw $$8, ${0:w}", "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}"(i16 %x) nounwind
45*9880d681SAndroid Build Coastguard Worker  ret i16 %asmtmp
46*9880d681SAndroid Build Coastguard Worker}
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: v16:
49*9880d681SAndroid Build Coastguard Worker; CHECK: rolw    $8,
50*9880d681SAndroid Build Coastguard Workerdefine zeroext i16 @v16(i16 zeroext %x) nounwind {
51*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i16 asm "rolw $$8, ${0:w}", "=r,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i16 %x) nounwind
52*9880d681SAndroid Build Coastguard Worker  ret i16 %asmtmp
53*9880d681SAndroid Build Coastguard Worker}
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: s32:
56*9880d681SAndroid Build Coastguard Worker; CHECK: bswapl
57*9880d681SAndroid Build Coastguard Workerdefine i32 @s32(i32 %x) nounwind {
58*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i32 asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %x) nounwind
59*9880d681SAndroid Build Coastguard Worker  ret i32 %asmtmp
60*9880d681SAndroid Build Coastguard Worker}
61*9880d681SAndroid Build Coastguard Worker
62*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t32:
63*9880d681SAndroid Build Coastguard Worker; CHECK: bswapl
64*9880d681SAndroid Build Coastguard Workerdefine i32 @t32(i32 %x) nounwind {
65*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i32 asm "bswap $0", "=r,0,~{dirflag},~{flags},~{fpsr}"(i32 %x) nounwind
66*9880d681SAndroid Build Coastguard Worker  ret i32 %asmtmp
67*9880d681SAndroid Build Coastguard Worker}
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: u32:
70*9880d681SAndroid Build Coastguard Worker; CHECK: bswapl
71*9880d681SAndroid Build Coastguard Workerdefine i32 @u32(i32 %x) nounwind {
72*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i32 asm "rorw $$8, ${0:w};rorl $$16, $0;rorw $$8, ${0:w}", "=r,0,~{cc},~{dirflag},~{flags},~{fpsr}"(i32 %x) nounwind
73*9880d681SAndroid Build Coastguard Worker  ret i32 %asmtmp
74*9880d681SAndroid Build Coastguard Worker}
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: s64:
77*9880d681SAndroid Build Coastguard Worker; CHECK: bswapq
78*9880d681SAndroid Build Coastguard Workerdefine i64 @s64(i64 %x) nounwind {
79*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i64 asm "bswap ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
80*9880d681SAndroid Build Coastguard Worker  ret i64 %asmtmp
81*9880d681SAndroid Build Coastguard Worker}
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t64:
84*9880d681SAndroid Build Coastguard Worker; CHECK: bswapq
85*9880d681SAndroid Build Coastguard Workerdefine i64 @t64(i64 %x) nounwind {
86*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i64 asm "bswap ${0:q}", "=r,0,~{fpsr},~{dirflag},~{flags}"(i64 %x) nounwind
87*9880d681SAndroid Build Coastguard Worker  ret i64 %asmtmp
88*9880d681SAndroid Build Coastguard Worker}
89