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