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