Files
clang-p2996/clang/test/CodeGen/align-loops.c
Fangrui Song c38efb4899 [clang] Implement -falign-loops=N (N is a power of 2) for non-LTO
GCC supports multiple forms of -falign-loops=.
-falign-loops= is currently ignored in Clang.

This patch implements the simplest but the most useful form where N is a
power of 2.

The underlying implementation uses a `llvm::TargetOptions` option for now.
Bitcode generation ignores this option.

Differential Revision: https://reviews.llvm.org/D106701
2021-08-05 12:17:50 -07:00

16 lines
470 B
C

// REQUIRES: x86-registered-target
/// Check asm because we use llvm::TargetOptions.
// RUN: %clang_cc1 -triple=x86_64 -S %s -falign-loops=8 -O -o - | FileCheck %s --check-prefixes=CHECK,CHECK_8
// RUN: %clang_cc1 -triple=x86_64 -S %s -falign-loops=32 -O -o - | FileCheck %s --check-prefixes=CHECK,CHECK_32
// CHECK-LABEL: foo:
// CHECK_8: .p2align 3, 0x90
// CHECK_32: .p2align 5, 0x90
void bar();
void foo() {
for (int i = 0; i < 64; ++i)
bar();
}