* tree-vect-loop-manip.c (vect_do_peeling): Do not use
[official-gcc.git] / libgo / misc / cgo / test / issue3261.go
blob71375698d376d8832727fab413d1a76a37794f5f
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.
5 package cgotest
7 /*
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.
10 #ifdef __ARMEL__
11 #include <stdio.h>
12 int vabs(int x) {
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__)
17 #include <stdio.h>
18 int vabs(int x) {
19 puts("testLibgcc is disabled on ARM64 with clang due to lack of libgcc.");
20 return (x < 0) ? -x : x;
22 #else
23 int __absvsi2(int); // dummy prototype for libgcc function
24 // we shouldn't name the function abs, as gcc might use
25 // the builtin one.
26 int vabs(int x) { return __absvsi2(x); }
27 #endif
29 import "C"
31 import "testing"
33 func testLibgcc(t *testing.T) {
34 var table = []struct {
35 in, out C.int
37 {0, 0},
38 {1, 1},
39 {-42, 42},
40 {1000300, 1000300},
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)
46 return