================ @@ -0,0 +1,76 @@ +//===-- IntelGPUTargetParserTest.cpp - Intel GPU Target Parser Test -------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "llvm/TargetParser/IntelGPUTargetParser.h" +#include "gtest/gtest.h" + +using namespace llvm; + +namespace { + +// Build a GPU IP version the way the Level Zero driver reports it. +constexpr uint32_t gpuIPVersion(uint32_t Architecture, uint32_t Release, + uint32_t Revision) { + return (Architecture << 22) | (Release << 14) | Revision; ---------------- tahonermann wrote:
Assert that the values of `Release` and `Revision` do not exceed their mask. ```suggestion assert(Release & ~0xFF == 0); assert(Revision & ~0x3F == 0); return (Architecture << 22) | (Release << 14) | Revision; ``` https://github.com/llvm/llvm-project/pull/222072 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
