1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 // libgcc on ARM might be compiled as thumb code, but our 5l
9 // can't handle that, so we have to disable this test on arm.
13 puts("testLibgcc is disabled on ARM because 5l cannot handle thumb library.");
14 return (x < 0) ? -x : x;
16 #elif defined(__arm64__) && defined(__clang__)
19 puts("testLibgcc is disabled on ARM64 with clang due to lack of libgcc.");
20 return (x < 0) ? -x : x;
23 int __absvsi2(int); // dummy prototype for libgcc function
24 // we shouldn't name the function abs, as gcc might use
26 int vabs(int x) { return __absvsi2(x); }
33 func testLibgcc(t
*testing
.T
) {
34 var table
= []struct {
41 {1 - 1<<31, 1<<31 - 1},
43 for _
, v
:= range table
{
44 if o
:= C
.vabs(v
.in
); o
!= v
.out
{
45 t
.Fatalf("abs(%d) got %d, should be %d", v
.in
, o
, v
.out
)