Debian Codegraph @

arrow/bitutil/Makefile

raw
1 # Licensed to the Apache Software Foundation (ASF) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The ASF licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # this converts rotate instructions from "ro[lr] <reg>" -> "ro[lr] <reg>, 1" for yasm compatibility
18 PERL_FIXUP_ROTATE=perl -i -pe 's/(ro[rl]\s+\w{2,3})$$/\1, 1/'
19
20 C2GOASM=c2goasm
21 CC=clang-11
22 C_FLAGS=-target x86_64-unknown-none -masm=intel -mno-red-zone -mstackrealign -mllvm -inline-threshold=1000 \
23 -fno-asynchronous-unwind-tables -fno-exceptions -fno-rtti -O3 -fno-builtin -ffast-math -fno-jump-tables -I_lib
24 ASM_FLAGS_AVX2=-mavx2 -mfma
25 ASM_FLAGS_SSE4=-msse4
26 ASM_FLAGS_BMI2=-mbmi2
27 ASM_FLAGS_POPCNT=-mpopcnt
28
29 C_FLAGS_NEON=-O3 -fvectorize -mllvm -force-vector-width=16 -fno-asynchronous-unwind-tables -mno-red-zone -mstackrealign -fno-exceptions \
30 -fno-rtti -fno-builtin -ffast-math -fno-jump-tables -I_lib
31
32 GO_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -not -name '*_test.go')
33 ALL_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -name '*.s' -not -name '*_test.go')
34
35 .PHONEY: assembly
36
37 INTEL_SOURCES := \
38 bitmap_ops_avx2_amd64.s bitmap_ops_sse4_amd64.s
39
40 #
41 # ARROW-15336: DO NOT add the assembly target for Arm64 (ARM_SOURCES) until c2goasm added the Arm64 support.
42 # min_max_neon_arm64.s was generated by asm2plan9s.
43 # And manually formatted it as the Arm64 Plan9.
44 #
45
46 assembly: $(INTEL_SOURCES)
47
48 _lib/bitmap_ops_avx2_amd64.s: _lib/bitmap_ops.c
49 $(CC) -S $(C_FLAGS) $(ASM_FLAGS_AVX2) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
50
51 _lib/bitmap_ops_sse4_amd64.s: _lib/bitmap_ops.c
52 $(CC) -S $(C_FLAGS) $(ASM_FLAGS_SSE4) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
53
54 bitmap_ops_avx2_amd64.s: _lib/bitmap_ops_avx2_amd64.s
55 $(C2GOASM) -a -f $^ $@
56
57 bitmap_ops_sse4_amd64.s: _lib/bitmap_ops_sse4_amd64.s
58 $(C2GOASM) -a -f $^ $@
59
60 clean:
61 rm -f $(INTEL_SOURCES)
62 rm -f $(addprefix _lib/,$(INTEL_SOURCES))