xref: /aosp_15_r20/external/toolchain-utils/compiler_wrapper/x64_flags_test.go (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
1// Copyright 2019 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package main
6
7import (
8	"testing"
9)
10
11func TestAddNoMovbeFlagOnX86(t *testing.T) {
12	withTestContext(t, func(ctx *testContext) {
13		cmd := ctx.must(callCompiler(ctx, ctx.cfg,
14			ctx.newCommand(gccX86_64, mainCc)))
15		if err := verifyArgOrder(cmd, mainCc, "-mno-movbe"); err != nil {
16			t.Error(err)
17		}
18	})
19}
20
21func TestAddNoMovbeFlagOnI686(t *testing.T) {
22	withTestContext(t, func(ctx *testContext) {
23		cmd := ctx.must(callCompiler(ctx, ctx.cfg,
24			ctx.newCommand("./i686-cros-linux-gnu-gcc", mainCc)))
25		if err := verifyArgOrder(cmd, mainCc, "-mno-movbe"); err != nil {
26			t.Error(err)
27		}
28	})
29}
30
31func TestDoNotAddNoMovbeFlagOnArm(t *testing.T) {
32	withTestContext(t, func(ctx *testContext) {
33		cmd := ctx.must(callCompiler(ctx, ctx.cfg,
34			ctx.newCommand(gccArmV7, mainCc)))
35		if err := verifyArgCount(cmd, 0, "-mno-movbe"); err != nil {
36			t.Error(err)
37		}
38	})
39}
40